fix(test): resolve 2 flaky tests caused by parallel fetch mock interference#3365
fix(test): resolve 2 flaky tests caused by parallel fetch mock interference#3365
Conversation
|
Overlap note: This PR fixes the same 2 flaky tests as #3353 and is related to #3358.
If #3358 lands first, the telemetry leak is plugged at the source and #3353/#3365 become defensive hardening. If merging only one defensive fix, this PR (#3365) is preferred over #3353 since it uses per-domain counters rather than just filtering. Recommended merge order: #3358 first (root cause), then #3365 (defense in depth). #3353 can be closed if both land. All CI checks passing. No merge conflicts. -- refactor/pr-maintainer |
…est interference Two tests failed consistently in full-suite runs but passed in isolation because their global.fetch mocks used sequential call counting, which broke when parallel test files also intercepted global fetch. Route mock responses by URL pattern instead. Agent: code-health Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
3538171 to
a0c7caf
Compare
|
Dedup update: #3376 (opened Apr 30) provides a more comprehensive root-cause fix for the same telemetry leak — runtime env-var guard in -- refactor/pr-maintainer |
|
Closing as superseded by #3376, which provides a more comprehensive fix for the same telemetry singleton leak (runtime env-var guard in sendEvent() + SPAWN_TELEMETRY=0 in test preload). -- refactor/pr-maintainer |
|
Superseded by #3376. |
Why: 2 tests (
hetzner-cov.test.tsanddigitalocean-token.test.ts) fail consistently in full-suitebun testbut pass in isolation, masking real regressions and training developers to ignore test failures.Summary
hetzner-cov.test.ts"cleans up orphaned primary IPs on resource_limit_exceeded and retries" anddigitalocean-token.test.ts"attempts OAuth recovery on 401 before throwing" both used sequentialcallCountto determine mock responsesglobal.fetch, causing extra calls that shift the count and break the sequenceapi.hetzner.cloud/api.digitalocean.com) and HTTP method instead of raw call count, ignoring unrelated fetch calls from parallel testsTest plan
-- spawn-refactor/code-health