Skip to content

test(spring-boot): [Sample Tests 6] Move the Boot 3 Person test into the module - #6292

Draft
runningcode wants to merge 1 commit into
no/agent-spring-boot-testfrom
no/boot-jakarta-integration-test
Draft

runningcode wants to merge 1 commit into
no/agent-spring-boot-testfrom
no/boot-jakarta-integration-test

Conversation

@runningcode

@runningcode runningcode commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Sample Tests)


📜 Description

Adds an integrationTest suite to sentry-spring-boot-jakarta. It runs a Spring Boot app in the test's own JVM, sends Sentry data to MockSentryServer, and ports the jakarta sample's PersonSystemTest:

  • Failed request:
    • the logged error and the thrown exception, both with their feature flag;
    • the http.server transaction and a span created through the Sentry API, each with its flag;
    • Sentry logs and their attributes.
  • Creating a person: the @SentrySpan span around the service method and the db.query span for the insert (P6Spy over in-memory HSQLDB).
  • Profiling: a profile chunk linked to the transaction through its profilerId.

How the suite is set up:

  • Its own suite: the module's unit-test classpath includes the OpenTelemetry agent, which would switch Sentry into agent mode. This suite's classpath matches a plain Boot 3 app.
  • Shared base class: IntegrationTest starts one application context and one MockSentryServer for the whole suite. @DynamicPropertySource points sentry.dsn at the server. Tests match envelopes on values only they produce, because a late envelope can arrive after the server is reset.
  • Separate package: the test app lives in io.sentry.spring.boot.jakarta.integrationtest, so component scanning doesn't pick up the module's own auto-configuration classes.
  • No security: the sample's Spring Security setup isn't copied, because none of these assertions depend on it.
  • CI: the Spring Boot 3 matrix now runs this suite and integrationTestOtelAgent on every Boot version it covers. Both suites are also part of check for now.

The sample's PersonSystemTest is deleted. Its other system tests stay until they're ported.

💡 Motivation and Context

This is the pilot for moving the Spring Boot sample tests into their modules. The sample's Person test needed the Python runner, a packaged app and the mock server, and its waits sleep 10s at a time. In-module, the whole class runs in about 3s, Spring startup included, with each test taking 30–470ms. The remaining Boot 3 sample tests follow in the next PRs; after that, the suite's CI cost settles whether these suites stay in check.

💚 How did you test it?

  • All three tests pass locally on Spring Boot 3.5.0.
  • Reproduced the matrix's oldest entry by setting the catalog to Spring Boot 3.2.12, as the workflow does. Both suites passed, and the startup banner showed v3.2.12.
  • Breaking the service-span assertion makes the test fail.
  • :sentry-spring-boot-jakarta: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

Port the rest of the jakarta sample's tests into this suite:

  1. DistributedTracing, plus Todo with a local stub instead of the internet call
  2. Cache, Metrics and FeatureFlag
  3. GraphQL
  4. Kafka, using EmbeddedKafka

#skip-changelog

Adds an integrationTest suite to sentry-spring-boot-jakarta that runs a
Spring Boot app in the test's JVM against MockSentryServer, and ports
the jakarta sample's PersonSystemTest to it: errors with feature flags,
the server transaction and its spans, logs, the JDBC query span and the
profile linked to the transaction.

It is a suite of its own because the unit tests' classpath carries the
OpenTelemetry agent, which switches Sentry into agent mode. Test classes
share one application context and one server, so the app starts once
per suite.

The Spring Boot 3 matrix now runs both of the module's integration
suites against every Boot version it covers.

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

This was referenced Oct 20, 2026

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