Skip to content

test(spring-boot): [Sample Tests 22] Move the Boot 2 OTel no-agent sample's tests - #6314

Draft
runningcode wants to merge 3 commits into
no/boot4-otel-noagent-integration-testfrom
no/boot2-otel-noagent-integration-test
Draft

runningcode wants to merge 3 commits into
no/boot4-otel-noagent-integration-testfrom
no/boot2-otel-noagent-integration-test

Conversation

@runningcode

@runningcode runningcode commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Sample Tests)


📜 Description

Adds an integrationTestOtelNoAgent suite to sentry-spring-boot, the Boot 2 counterpart of #6312's. It ports sentry-samples-spring-boot-opentelemetry-noagent's tests, which match the Boot 3 no-agent sample's except for the missing Cache and RestClient tests (Boot 2 has no RestClient). So the suite is #6312's, with the Boot 2 servlet suite's (#6299, #6300) adjustments:

  • Outgoing calls: RestTemplate instead of RestClient. WebClient is called on the request thread.
  • GraphQL and Kafka run only on Spring Boot 2.7 and later, and Kafka gets its own context with the kafka profile.
  • Server port: read from local.server.port, because @LocalServerPort moved packages in Boot 2.7.

One new problem: each test class needs its own context. Sentry is global, so the second context the Kafka test starts re-initializes it with that context's OpenTelemetry SDK. Spans that later tests created through the Sentry API then went to that SDK instead of their own app's. Their transactions came without them, and 5 tests failed. They passed when run without the Kafka test.

With @DirtiesContext on the base class, each test class starts its own context and closes it afterwards, so only one context is ever live. The suite's test time stays around 8s, close to the Boot 3 suite. The servlet suite (#6300) doesn't have this problem, because without OpenTelemetry the Sentry API spans don't go through an SDK bound to one context.

As in #6312, the sample's MetricsSystemTest runs in this suite too.

With no system tests left, the sample comes off the runner and the Spring Boot 2 matrix. The matrix now runs the new suite, and integrationTests includes it too. The sample was also the base row of the backend workflow's matrix, so that row moves to sentry-samples-console.

After a coverage audit against the sample's tests:

💡 Motivation and Context

With the sample's tests gone, this suite is the only coverage of sentry-opentelemetry-agentless-spring on Boot 2. It runs 19 tests, or 12 on Boot versions below 2.7.

💚 How did you test it?

  • All 19 tests pass on Spring Boot 2.7.18.
  • With the catalog set to 2.4.13, the 12 tests that don't need GraphQL or Kafka pass.
  • Expecting the wrong URL on the Todo client span makes those tests fail.
  • With one database name shared by all the contexts, every class after the first fails, which is why each context gets its own database.
  • :sentry-spring-boot:check passes.

📝 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 OTel agent samples for Boot 2, 3 and 4.

#skip-changelog

🤖 Generated with Claude Code

…the module

Adds an integrationTestOtelNoAgent suite to sentry-spring-boot, the
Boot 2 counterpart of the Boot 3 one. The sample's tests were the Boot 3
sample's minus Cache and RestClient, which Boot 2 doesn't have.
GraphQL and Kafka are gated on Boot 2.7, as in the servlet suite, and
Kafka gets a context of its own.

Sentry is global, so a second live context re-initializes it with that
context's OpenTelemetry SDK, and the Sentry API spans of the first
context's tests went to the wrong one. Each test class therefore starts
its own context and closes it afterwards.

The sample has no system tests left, so it comes off the system-test
runner and the Spring Boot 2 matrix, which now runs the new suite, and
the backend workflow's base row moves to the console sample.
integrationTests includes the suite too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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 20, 2026 20:57
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…gent and restore Metrics

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

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