Skip to content

Fix flaky HTTPX and Typhoeus instrument tests - #637

Merged
jrothrock merged 3 commits into
masterfrom
fix-flaky-http-tests
Sep 28, 2026
Merged

jrothrock merged 3 commits into
masterfrom
fix-flaky-http-tests

Conversation

@jrothrock

Copy link
Copy Markdown
Contributor

The HTTPX and Typhoeus instrument tests made real network calls to third-party services (news.ycombinator.com, google.com, httpbin.org, example.com), causing intermittent failures from network/DNS/rate-limit variance. A failed dispatch meant no layer was recorded, surfacing as Expected: 1, Actual: 0.

Stub the endpoints with WebMock so every request dispatches deterministically through the instrumented method and the layer always records.

🤖 Generated with Claude Code

jrothrock and others added 3 commits September 28, 2026 10:33
Stub external HTTP with WebMock instead of hitting real services
(news.ycombinator.com, google.com, httpbin.org, example.com), which
caused intermittent failures from network/DNS/rate-limit variance.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Ruby 4 instruments matrix uses instruments-ruby4.gemfile, which was
missing webmock, so httpx_test failed to load.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
TyphoeusTest/HTTPXTest#setup overrode the base setup without calling
super, so Thread.current[:scout_request] was never cleared. When a prior
test left an open TrackedRequest on the thread, RequestManager.lookup
reused it and the HTTP layer nested under the stale root instead of
recording, causing intermittent "recorded no layers" failures dependent
on test order/seed. Call super in setup/teardown to restore the reset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jrothrock
jrothrock merged commit f25224c into master Sep 28, 2026
42 checks passed
@jrothrock
jrothrock deleted the fix-flaky-http-tests branch September 28, 2026 17:53
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.

2 participants