Skip to content

test: [Sample Tests 1] Add an in-process MockSentryServer - #6266

Merged
runningcode merged 1 commit into
mainfrom
no/mock-sentry-server
Oct 21, 2026
Merged

runningcode merged 1 commit into
mainfrom
no/mock-sentry-server

Conversation

@runningcode

@runningcode runningcode commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Sample Tests)


📜 Description

This adds MockSentryServer to sentry-test-support. It replaces the existing system-test-runner.py and test/system-test-sentry-server.py.
We can't delete that one yet until we migrate all the tests though.

💡 Motivation and Context

This is the first step of moving the end-to-end system tests out of sentry-samples/ and into the modules they cover. It will also enable test parallelization as we can run tests in parallel using a free port.

Little summary from the llm:
Today those tests need three things outside Gradle:

  • test/system-test-runner.py
  • a Python mock server on :8000
  • a packaged sample app

That means they can't run as part of a module's test task. Two properties of MockSentryServer matter for the follow-ups:

  • The free port lets test tasks run in parallel without clashing.
  • Speaking HTTP means it can serve apps in a child JVM too, which the OTel agent tests need.

💚 How did you test it?

  • MockSentryServerTest covers two cases:
    • a real Sentry.init → captureMessage → the envelope arrives;
    • awaitEnvelope times out when nothing matches.
  • :sentry-android-integration-tests:sentry-uitest-android:assembleAndroidTest fails with R8 Missing class com.sun.net.httpserver.* without the new rule, and passes with it.

📝 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 next PRs in this stack share the envelope matchers, move the logback sample's test, and add the first OTel agent test.
  • Later stacks port the Spring Boot sample tests into per-module test suites and retire the Python runner.

#skip-changelog

First step of moving the sample system tests into the modules they
cover. The server stands in for the Python mock server: it binds a free
port, accepts envelopes through the SDK's real HTTP transport, and lets
tests wait for a matching one.

The release-minified UI test APK pulls in sentry-test-support, so R8
needs to be told the JDK-only com.sun.net.httpserver classes are absent.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@runningcode
runningcode force-pushed the no/mock-sentry-server branch from ba3ad5c to 254fe63 Compare October 15, 2026 14:23
@sentry

sentry Bot commented Oct 15, 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 runningcode added the sanity-check PR needs a lightweight review for obvious issues label Oct 15, 2026

@markushi markushi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice start, LGTM!

This was referenced Oct 20, 2026
@runningcode
runningcode merged commit ece9581 into main Oct 21, 2026
99 of 100 checks passed
@runningcode
runningcode deleted the no/mock-sentry-server branch October 21, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants