Repository navigation
test(spring-boot): [Sample Tests 7] Move the Boot 3 tracing and HTTP client tests - #6293
Draft
runningcode wants to merge 2 commits into
Draft
runningcode wants to merge 2 commits into
runningcode wants to merge 2 commits into
Conversation
… the module Ports the jakarta sample's DistributedTracingSystemTest and TodoSystemTest to the integrationTest suite. The app calls itself on its random port instead of a hardcoded localhost:8080, and serves the todo the sample fetched from jsonplaceholder.typicode.com, so the tests no longer need the internet. Adds MockSentryServer.assertNoEnvelope for the unsampled case. A flush can't prove an absence because the server may finish its transaction after the client already has the response, so it watches for a short window instead of the old 10s sleep. The suite declares context-propagation explicitly: without it Reactor can't carry the Sentry scope to the WebClient's thread. The sample only had it because Spring GraphQL pulls it in. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 20, 2026
📲 Install BuildsAndroid
|
This was referenced Oct 20, 2026
Draft
Draft
Draft
Draft
Draft
This was referenced Oct 20, 2026
Draft
Draft
Draft
Draft
…test client The unsampled-trace test now sends a request with an id of its own and rejects any transaction for it, whatever its trace, so a mishandled header that starts a new trace fails it. The sampled test checks that transactions carry their request, which that relies on. The sample_rand and deferred-sampling tests also check the envelope header's trace ID, as the sample's tests did. That check showed that the context's TestRestTemplate, built from the RestTemplateBuilder Sentry customizes, added trace headers of its own to the requests the tests sent. The suite now uses one built outside the context. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Stack (Sample Tests)
main)📜 Description
Ports the jakarta sample's
DistributedTracingSystemTestandTodoSystemTestto theintegrationTestsuite insentry-spring-boot-jakarta, and deletes them from the sample.Distributed tracing. Each test sends
sentry-trace/baggageheaders to/tracing, which forwards to the app's own/personendpoint. The tests check that the transactions on both sides carry the incoming trace:sample_rand: the generated value is the same on both sides;sample_rategets updated.HTTP clients. RestTemplate, WebClient, RestClient and OkHttp each fetch a todo. Each request's transaction must contain the matching
http.clientspan.Changes from the sample:
localhost:8080.jsonplaceholder.typicode.com.MockSentryServer.assertNoEnvelope: new helper for the unsampled case. CallingSentry.flush()and then checking can't prove nothing was sent, because the server can finish its transaction after the client already has the response. So it watches for 2s, replacing the old 10s sleep. With a sampled trace, the check fails as it should.context-propagation: now declared explicitly. Without it, Reactor can't carry the Sentry scope to the WebClient's thread, and the WebClient span disappears. The sample only had it because Spring GraphQL pulls it in.After a coverage audit against the sample's tests:
sample_randand deferred-sampling tests check the envelope header's trace ID again, as the sample did.TestRestTemplatecomes from theRestTemplateBuilderthat Sentry customizes. So it addedbaggagefrom the test JVM's own trace to every request, and the tracing tests ran on mixed headers. The suite now uses a client built outside the context.💡 Motivation and Context
This continues the Spring Boot 3 pilot.
With these, the suite's 12 tests take about 5s, including Spring startup and the 2s negative wait.
💚 How did you test it?
MockSentryServerTestcovers both outcomes ofassertNoEnvelope.:sentry-test-support:checkand:sentry-spring-boot-jakarta:checkpass.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
Still to port from the jakarta sample:
#skip-changelog