|
| 1 | +# Fix: widen the timing margin in the provider-mirror concurrency regression test |
| 2 | + |
| 3 | +**Date:** 2026-08-06 |
| 4 | + |
| 5 | +## Summary |
| 6 | + |
| 7 | +`TestProviderMirror_VersionResolvesPlatformsConcurrently` |
| 8 | +(`pkg/terraform/registry/provider_mirror_test.go`) failed on the Windows |
| 9 | +Acceptance Tests CI job: resolving 10 platforms took 784ms against a 750ms |
| 10 | +threshold. The test's own concurrency assertion was actually satisfied — |
| 11 | +784ms is nowhere near the 1.5s serial floor the test exists to catch — it |
| 12 | +just tripped an overly tight pass/fail bound under normal CI timing |
| 13 | +variance. No production code changed; this is a flaky-test fix. |
| 14 | + |
| 15 | +## Context |
| 16 | + |
| 17 | +The test spins up a local HTTP mirror server where each of 10 platform |
| 18 | +downloads sleeps a fixed 150ms (`delay`), then asserts that resolving the |
| 19 | +version endpoint (which fetches all 10 platform archives) completes in |
| 20 | +under half of the theoretical serial floor (`platformCount * delay / 2` = |
| 21 | +750ms) — proving the platforms are fetched concurrently (~1 delay) rather |
| 22 | +than serially (~10 delays = 1.5s). A concurrent run's actual wall time is |
| 23 | +one delay plus scheduling/HTTP/goroutine overhead; on a loaded or |
| 24 | +virtualized CI runner — Windows acceptance-test runners in particular are |
| 25 | +slower and more variable than local dev machines — that overhead alone can |
| 26 | +approach several hundred milliseconds, which the 750ms bound had no real |
| 27 | +margin for. This is not related to any other change on this branch; |
| 28 | +`pkg/terraform/registry/provider_mirror_test.go` was last touched by |
| 29 | +unrelated PRs on `main` (#2534, #2582). |
| 30 | + |
| 31 | +## Changes |
| 32 | + |
| 33 | +- `pkg/terraform/registry/provider_mirror_test.go`: raised the pass |
| 34 | + threshold from `serialFloor/2` (750ms) to `serialFloor*4/5` (1200ms). |
| 35 | + This keeps a wide, unambiguous gap from the 1.5s serial floor a true |
| 36 | + regression to serial resolution would hit, while tolerating realistic CI |
| 37 | + timing variance that a tighter bound doesn't survive. |
| 38 | + |
| 39 | +## Validation |
| 40 | + |
| 41 | +- `go build ./...` — clean. |
| 42 | +- `go test ./pkg/terraform/registry/... -run TestProviderMirror_VersionResolvesPlatformsConcurrently -v -count=5` |
| 43 | + — 5/5 pass, each completing in ~310ms (comfortably under the new 1200ms |
| 44 | + bound, comfortably above what a serial regression would need to trip the |
| 45 | + assertion). |
| 46 | +- `go test ./pkg/terraform/registry/...` (full package) — pass. |
| 47 | +- `atmos lint --changed` — 0 issues. |
| 48 | +- Did not reproduce the exact 784ms Windows CI timing locally (this |
| 49 | + machine isn't the flaky runner); the fix targets the assertion's margin, |
| 50 | + not the code path's actual performance, which the test itself already |
| 51 | + confirmed was correct (concurrent, well under the serial floor) even in |
| 52 | + the failing run. |
| 53 | + |
| 54 | +## Follow-ups |
| 55 | + |
| 56 | +None. |
0 commit comments