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) <noreply@anthropic.com>
@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
runningcode added a commit that referenced this pull request Oct 21, 2026
* chore: update scripts/update-sentry-native-ndk.sh to 0.17.4 (#6278)

Co-authored-by: GitHub <noreply@github.com>

* feat(android): Add masked screenshot capture for Hybrid SDKs (#6281)

* feat(android): Add masked screenshot capture for Hybrid SDKs

Hybrid SDKs capture screenshots for their own errors through
ScreenshotUtils.takeScreenshot, which ignores the screenshot masking
options. Add ScreenshotUtils.takeMaskedScreenshot, backed by a shared
captureMaskedScreenshot that ScreenshotEventProcessor now uses as well,
so native and hybrid screenshots follow the same masking rules.

Refs getsentry/sentry-react-native#6900

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* changelog

* ref(android): Narrow catches in ScreenshotMasking

Catch only InterruptedException around the main-thread wait and
RuntimeException around bitmap masking. Keep the broad catch for view
hierarchy traversal, which runs custom View code, but let fatal errors
through with ExceptionUtils.rethrowIfFatal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* changelog: Move entry to Internal

* ref(android): Move replay availability check to ScreenshotMasking

Add ScreenshotMasking.isAvailable() so the replay integration class name
no longer needs to be public on SentryAndroid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* ci: Move jobs from Bitrise back to GitHub-hosted runners (#6289)

Co-Authored-By: Nelson Osacky <nelson.osacky@sentry.io>

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>

* chore(deps): bump the github-actions group across 1 directory with 4 updates (#6280)

Bumps the github-actions group with 4 updates in the / directory: [actions/setup-java](https://github.com/actions/setup-java), [github/codeql-action/init](https://github.com/github/codeql-action), [github/codeql-action/analyze](https://github.com/github/codeql-action) and [getsentry/craft](https://github.com/getsentry/craft).


Updates `actions/setup-java` from 6.0.1 to 6.1.0
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@de7274f...b843ebf)

Updates `github/codeql-action/init` from 4.38.3 to 4.39.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@24c5418...6f2ac81)

Updates `github/codeql-action/analyze` from 4.38.3 to 4.39.0
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@24c5418...6f2ac81)

Updates `getsentry/craft` from 2.34.1 to 2.35.0
- [Release notes](https://github.com/getsentry/craft/releases)
- [Changelog](https://github.com/getsentry/craft/blob/master/CHANGELOG.md)
- [Commits](getsentry/craft@3f2abdc...7a78575)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-version: 6.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: getsentry/craft
  dependency-version: 2.35.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs: Require issue discussion before PRs (#6288)

* docs: Require issue discussion before PRs
Co-Authored-By: Chris Aigner <christoph.aigner@sentry.io>

* docs: Add Sentry logo header to CONTRIBUTING.md
Co-Authored-By: Chris Aigner <christoph.aigner@sentry.io>

* Apply suggestion from @christophaigner

* Apply suggestion from @christophaigner

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Chris Aigner <25478494+christophaigner@users.noreply.github.com>

* fix(client-reports): Count spans in batched span envelope items (#6265)

Prior to this commit, ClientReportRecorder didn't have any explicit logic for dealing with span envelopes because sentry-java didn't implement them. That meant that any span envelopes created by hybrid SDKs and dropped by sentry-java would be shunted to the recorder's fallback branch and wrongly register a single dropped span per dropped envelope, rather than the actual number.

This commit adds the missing span envelope logic, so that we now report the actual span count.

Refs [sentry-docs#19854](getsentry/sentry-docs#19854)

* build(deps): Bump certifi to 2026.10.19 (#6333)

Removes trust in the compromised eMudhra/emSign CA roots (VULN-3216).

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Geoff Goldsmith <geoff.goldsmith@sentry.io>

* test: Add an in-process MockSentryServer to sentry-test-support (#6266)

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) <noreply@anthropic.com>

* ci: Use the latest Python 3.10 patch in CI (#6339)

ubuntu-latest now resolves to Ubuntu 26.04, and actions/python-versions
ships no 3.10.5 build for it, so "Set up Python" fails before any test
runs in the Spring Boot matrix and system-test jobs. Pinning the minor
version lets setup-python pick the newest 3.10.x available for the
runner image while keeping requirements.txt and the system-test runner
on the same Python minor.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* chore(build): Compile with a JDK 21 toolchain and upgrade Mockito and Error Prone (#6242)

* build: Switch to JDK 21 and upgrade Mockito, Robolectric and Error Prone

* build: Compile tests for JDK 21 and fix buildSrc JVM target

* build: Compile with a JDK 21 toolchain from a build-logic convention plugin

* docs(kafka): Explain the explicit double cast at the latency call site

* build: Compile the samples and their tests with the toolchain JDK

* Format code

* build: Drop the now-unused JvmTarget imports from the samples

* build: Clarify the jvm-targets plugin comments and rename its helper

* build: Require JDK 21 to run Gradle again

* build: Keep the Spring Boot 2 sample apps on their published bytecode level

* ci: Drop the stale Java version from the build job name

* build: Keep Robolectric at 4.15 and leave its test environment untouched

* build: Move the Java 8 release pin into the jvm-targets convention plugin

* build: Drop the Error Prone and NullAway code fixes, they move to their own PR

* ci: Drop the stale Java version from the build job name

* fix(core): Suppress the new Error Prone and javac 21 findings in the sentry module

* fix(core): Resolve the remaining Error Prone and javac 21 findings in the sentry module

* build: Move the JDK and bytecode level decisions into the io.sentry.compilation plugin

* Address PR comments

* test(android): Make the flush timeout verifies match the real log call

* chore(core): Reword the JDK 21 suppression comments

* build: Keep only the javac unit test targets inside afterEvaluate

* build: Drop afterEvaluate, pin the Kotlin API level and rename the convention plugin

* Fix JDK 21 findings in sentry-android-core (#6261)

Fix JDK 21 findings in sentry-android-core

* Fix JDK 21 findings in the Spring modules (#6260)

* Fix JDK 21 findings in the JVM integrations (#6259)

* fix multiplatform target compilations

---------

Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub <noreply@github.com>
Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chris Aigner <25478494+christophaigner@users.noreply.github.com>
Co-authored-by: Adam Brown <adam.brown@sentry.io>
Co-authored-by: Geoff Goldsmith <geoff.goldsmith@sentry.io>
Co-authored-by: Nelson Osacky <nelson.osacky@sentry.io>
Co-authored-by: Markus Hintersteiner <markus.hintersteiner@sentry.io>
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
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