servers: deterministic probe-stall test via transport injection seam (#179)#186
Merged
Conversation
…179) The probe-stall test manufactured its stall by pointing the DSN at a local HTTP server whose handler blocked, racing a shrunk probe window. Under machine load the dial could be REFUSED instead of connect-and-hang — a fast send outcome that drains the queue, flushes, and prints the success line, failing both assertions. Replace the socket with a test-only transport injection seam: sentryTransportOverride (nil in production — the SDK builds its real HTTP transport unchanged) feeds setupSentry's ClientOptions, and the test injects the existing stubTransport with flushDrains=false. The stalled-transport premise now holds by construction — no socket, no wall-clock race. The test still pins that setupSentry invokes the probe against the client it just configured: the canary must arrive at the injected transport, and deleting the probe call stays red.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #179.
What
Makes
TestSetupSentry_ProbeStall_WarnsAndWithholdsEnabledLinedeterministic — the stalled-transport premise now holds by construction instead of winning a dial-timing race.servers/sentry.go:sentryTransportOverrideseam (package var, nil in production — production construction byte-identical, verified against sentry-go v0.46.2setupTransport). Wired intosetupSentry'sClientOptions.Transport.servers/sentry_test.go: the probe-stall test injects the existingstubTransport{flushDrains: false}via the seam — no blocking httptest server, no shrunk probe window, no socket in the stall premise. Strengthened pin: the canary must arrive at the injected transport, proving the probe ran against the clientsetupSentryjust configured.setSentryTransportOverridehelper self-registers the cleanup reset (set-without-reset unwritable); seam comment documents the SDK client-mode divergence (non-nil transport → legacy-transport mode; re-check on SDK bumps).Validation
sentryStartupProbe()call → red on all three assertions; unwiring the seam → red on the canary pin.go test -count=100 ./servers/green concurrent with a looping-racefull-module suite; zero failures.-race -count=3 -shuffle=on ./servers/,make test-integration(MariaDB harness), gofmt — all green; re-verified post-rebase onto 03dae4b.🤖 Generated with Claude Code