Skip to content

test(spring-boot): [Sample Tests 23] Port the Boot 3 OTel agent sample's Person, tracing and Todo tests - #6315

Draft
runningcode wants to merge 2 commits into
no/boot2-otel-noagent-integration-testfrom
no/boot3-otel-agent-integration-test
Draft

runningcode wants to merge 2 commits into
no/boot2-otel-noagent-integration-testfrom
no/boot3-otel-agent-integration-test

Conversation

@runningcode

@runningcode runningcode commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Sample Tests)


📜 Description

Grows #6271's agent suite in sentry-spring-boot-jakarta from a single Person request into a port of sentry-samples-spring-boot-jakarta-opentelemetry's Person, DistributedTracing and Todo tests. The sample's Cache, Metrics, GraphQL and Kafka tests follow in the next PR, which retires the sample.

One app per test JVM. The fixture app runs in a child JVM with the built agent attached and takes seconds to start. It used to start once per test; now AgentApp starts it on first use, every test class shares it, and it stops when the JVM exits. The tests themselves are the no-agent suite's (#6312), adapted to the agent sample:

  • Person: the agent sample's flags. @WithSpan is gone, because the agent sample doesn't use it.
  • DistributedTracing: unchanged.
  • Todo: unchanged. The sample only checked the op of RestClient's client span, but the full description check passes in agent mode too.

One task per init mode. Whether the agent or the Spring Boot starter initializes Sentry is now a property of the task:

  • integrationTestOtelAgent runs with the agent initializing Sentry.
  • The new integrationTestOtelAgentWithoutAutoInit runs the same tests with SENTRY_AUTO_INIT=false, so the Spring Boot starter does it.

Gradle runs the two in parallel. Both are in check, the Boot 3 matrix and integrationTests. The Person test still checks the SDK name, which shows that each mode takes its own init path.

Speed. Sentry exports the agent's spans through a BatchSpanProcessor with a fixed 5-second schedule. In the app's JVM there's no way to flush it, as #6312 does in-process. Each test that waits for a transaction waits for the next batch, so the tests take about 5 seconds each: about 66s per mode for 13 tests, with both modes in parallel. The runner spent about 10 seconds per test. The unsampled-trace check waits 6 seconds, so it covers a full batch.

App output. ChildJvmApp now copies the app's output into the test's as it arrives, rather than printing it on close(). The shared app closes when the JVM exits, and its whole log (1,200 lines, mostly the stack traces of the intentionally failing requests) would otherwise land on the console. This way Gradle's test report shows each line with the test that was running.

After a coverage audit against the sample's tests:

💡 Motivation and Context

These are the first in-module tests that exercise the agent in both init modes across Person, tracing and Todo. In CI, the sample's auto-init=false run restores systemTest from cache, so it has likely never run.

💚 How did you test it?

  • All 13 tests pass in both modes on Spring Boot 3.5.0.
  • They also pass with the catalog set to 3.2.12.
  • Expecting the wrong starter SDK name fails only the WithoutAutoInit task.
  • With the output change, a run prints no app log to the console, and the test report has it.
  • AgentSmokeTest still passes.
  • :sentry-spring-boot-jakarta:check and :sentry-test-support:check pass.

📝 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

The agent sample's Cache, Metrics, GraphQL and Kafka tests, which retire the sample.

#skip-changelog

🤖 Generated with Claude Code

This was referenced Oct 20, 2026
@sentry

sentry Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

runningcode and others added 2 commits October 21, 2026 13:22
…g and Todo tests

The agent tests now start the fixture app once per test JVM and share
it, because it takes seconds to start. Which mode initializes Sentry is
a property of the test task, so the suite's task runs with the agent
initializing it and a new integrationTestOtelAgentWithoutAutoInit task
runs the same tests with the Spring Boot starter doing it. Gradle runs
the two in parallel.

The fixture gains the Person POST, distributed tracing and Todo
endpoints, and the suite ports the agent sample's Person,
DistributedTracing and Todo tests. Sentry exports the agent's spans in
batches every 5 seconds, which can't be configured, so each test waits
for the next batch and the negative tracing check waits past one.

ChildJvmApp now copies the app's output into the test's as it arrives
instead of printing it on close. The shared app is closed when the JVM
exits, where its whole log would otherwise land on the console.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/boot2-otel-noagent-integration-test branch from ab1dda5 to 4910189 Compare October 21, 2026 11:27
@runningcode
runningcode force-pushed the no/boot3-otel-agent-integration-test branch from ee9b468 to 4645281 Compare October 21, 2026 11:27

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