Skip to content

test: [Sample Tests 44] Fix follow-ups from the stack review - #6390

Open
romtsn wants to merge 1 commit into
no/spring-boot-oldest-compile-checkfrom
romtsn/test/sample-tests-followups
Open

romtsn wants to merge 1 commit into
no/spring-boot-oldest-compile-checkfrom
romtsn/test/sample-tests-followups

Conversation

@romtsn

@romtsn romtsn commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

PR Stack (Sample Tests)

The earlier stack PRs (#6266 to #6332) are merged.


📜 Description

This fixes issues that a review of the merged Sample Tests stack found in the new end-to-end tests. Each issue came from the stack itself; none existed before it.

  • MockSentryServer surfaces bodies it can't read. Before, a deserialization error left the handler with no trace, and the test only failed on its timeout ("received N envelopes"). The server now answers 500, keeps the error, and awaitEnvelope / assertNoEnvelope rethrow it as the cause.
  • ChildJvmApp.awaitPort waits for a stable port. Neither Spring Boot's WebServerPortFileWriter nor HelloServer writes the file atomically, and a partial read such as "54" of "54321" parses. The port now counts only when two reads agree.
  • AgentlessEndToEndTest checks the OpenTelemetry wiring. Before, it only used the Sentry API, so it passed when the span factory fell back to the default one. It now starts a span through GlobalOpenTelemetry and asserts that the span arrives as a Sentry transaction with the same trace ID.
  • Person tests no longer match the tracing tests' envelopes. DistributedTracingIntegrationTest calls /tracing/1, which calls /person/1 and sends the same id=1 event, error and GET /person/{id} transaction that PersonIntegrationTest waits for. The Person tests now use id 11, as the Spring WAR suites do, and match their transaction by request URL.
  • The Boot 2 Kafka test shares the suite's context. Its second context ran Sentry.init again and replaced the first context's options, which made later test classes depend on the run order. The split existed because Boot 2.4 to 2.6 had no Kafka support, and test(spring-boot): [Sample Tests 41] Drop Spring Boot 2.4 to 2.6 from the test matrix #6381 dropped them. Boot 2 now has the same setup as Boot 3 and 4: @EmbeddedKafka on the shared base class and no kafka profile. The ${random.uuid} datasource workaround is gone too.
  • Missing test system properties fail clearly. An IDE run without the Gradle task got -javaagent:null or silently chose the starter init mode. The new helper requiredTestProperty names the missing property.
  • Cleanup:

💡 Motivation and Context

These are follow-ups from a review of the Sample Tests stack (#6266 to #6332).

I left these out on purpose:

  • No OS guard for the async-profiler tests. CI runs only on Linux, and the existing JavaContinuousProfilerTest has no guard either.
  • Child JVM output still goes to the console. The ChildJvmApp KDoc says this is intended, so that Gradle's report shows the app log with the test.
  • The OTLP suite sets sentry.traces-sample-rate=1.0 together with OTLP. The open question from test(spring-boot): [Sample Tests 37] Move the Boot 4 OTLP sample's tests into the module #6329 still needs an answer.

💚 How did you test it?

I ran these with JDK 21, and all 205 tests passed:

  • :sentry-test-support:test, which includes a new test that posts a body that is not an envelope
  • :sentry-opentelemetry:sentry-opentelemetry-agentless:test and :sentry-opentelemetry:sentry-opentelemetry-agent:test
  • :sentry-spring-boot:integrationTest, integrationTestOtelNoAgent and integrationTestOtelAgent
  • :sentry-spring-boot-jakarta:integrationTest and integrationTestOtelAgentWithoutAutoInit
  • :sentry-spring-boot-4:integrationTest, integrationTestOtlp and integrationTestOtelNoAgent

I also compiled the 4 changed Boot 2 samples (compileKotlin).

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

None.

#skip-changelog

🤖 Generated with Claude Code

@sentry

sentry Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.62.0 (1) release

⚙️ sentry-android Build Distribution Settings

@romtsn
romtsn marked this pull request as ready for review October 27, 2026 13:22
@runningcode
runningcode force-pushed the romtsn/test/sample-tests-followups branch from cc62544 to c0d347b Compare October 27, 2026 14:33
@runningcode
runningcode requested a review from a team as a code owner October 27, 2026 14:33
@runningcode
runningcode force-pushed the no/spring-boot-oldest-compile-check branch from d2dac4e to 25c20ff Compare October 27, 2026 14:33
Fix issues the review of the sample tests stack found in the new
in-module end-to-end tests:

- MockSentryServer keeps the error when it can't read a body and
  rethrows it while waiting, so a serialization bug no longer looks
  like a missing envelope.
- ChildJvmApp only takes a port that two reads agree on. A partly
  written port such as "54" of "54321" parsed and pointed the test
  at the wrong port.
- The agentless test starts a span through the OpenTelemetry API and
  checks that it reaches Sentry. Before, it passed with the
  OpenTelemetry wiring broken.
- The Person tests use id 11 and match their transaction by URL, so
  envelopes from the tracing tests' /person/1 calls can't satisfy them.
- The Boot 2 Kafka test shares the suite's context and broker, as on
  Boot 3 and 4. Its second context re-ran Sentry.init and made later
  tests depend on the run order. Boot 2.4 to 2.6 were the reason for
  the split and are gone.
- Tests fail clearly when a system property the Gradle task sets is
  missing, rather than running with -javaagent:null.
- Remove the Boot 2 version gating from the samples, the runner's
  files from .gitignore, and the unused jackson-kotlin entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the romtsn/test/sample-tests-followups branch from c0d347b to 899abf7 Compare October 27, 2026 15:08
@runningcode
runningcode force-pushed the no/spring-boot-oldest-compile-check branch from 25c20ff to 8eb9829 Compare October 27, 2026 15:08

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant