Skip to content

Timing-sensitive tests fail under load (pool spread, lab 2 wildcard, SARIF) #167

Closed

Description

@TMHSDigital

Summary

Three tests depend on wall-clock timing and fail under load: TestPoolSpreadsLoad, TestE2ELabs/lab2_-force_filters_the_wildcard and TestE2ESARIF. All pass in isolation. A full coverage-instrumented run on a quiet workstation reproduced all three failures.

Where

  • internal/scan/pool_test.go:36-64 (TestPoolSpreadsLoad, asserts a 3x wall-clock ratio)
  • main_lab_test.go:39-42, 54-71, 175-179 (lab E2E cases use the CLI default -timeout 1000)
  • main.go:179 (default timeout), .github/workflows/go.yml:70 (CI runs the full suite with -race)

Details

TestPoolSpreadsLoad failed with "20 resolvers took 642ms, 1 took 1.30s; want at least 3x faster". Lab 2 returned all 30 words instead of 3: the wildcard fingerprint probe timed out, so -force continued without a fingerprint (runner.go:508-515) and everything was reported. Only one lab case passes an explicit -timeout (main_lab_test.go:84). The lab tests talk to an in-process UDP dnsserver, so a 1 s timeout is generous on an idle machine and insufficient under -race plus coverage on a busy CI runner.

Impact

Red CI on slow runners masks real regressions. The lab 2 failure mode (everything reported) is exactly the regression that test exists to catch, so a flaky version trains people to re-run instead of read.

Suggested fix

  • Pass -timeout 5000 -attempts 3 in every TestE2ELabs, TestE2ESARIF and TestE2ELabTakeoverHint invocation (or via the shared helper)
  • Lab 2 -force: also assert the notice stream does not contain "wildcard detection failed", so a timeout-induced pass-through fails with a clear message
  • TestPoolSpreadsLoad: replace the wall-clock ratio with a deterministic observable (max concurrent in-flight queries per resolver as seen by the handler); keep the timing version as a Benchmark
  • Add -shuffle=on to the CI go test invocation and run the suite twice locally under -race with GOMAXPROCS=2 before closing

Acceptance criteria

  • go test -race -count=5 ./... passes with GOMAXPROCS=2
  • No test asserts on elapsed time

Getting started

  • Relevant files: internal/scan/pool_test.go, main_lab_test.go, main_e2e_test.go
  • How to run tests: go test -race -count=3 ./internal/scan/ .
  • Related docs: docs/CONTRIBUTING.md testing section

Filed by repo-audit/full-audit at 3139c44. Severity: high. Effort: S. audit-key: testing|internal/scan/pool_test.go|flaky timing

Activity

  1. added
    testing
    severity: high
    on Nov 9, 2026
  2. TMHSDigital commented on Nov 9, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in 1f8c657.

    • Lab E2E tests (TestE2ELabs, TestE2ESARIF, TestE2ELabTakeoverHint) pass -timeout 5000 -attempts 3; TestE2ELabs fails with a clear message if the wildcard probe timed out.
    • TestPoolSpreadsLoad checks lookups per pool member (all 20 used, none above a quarter) instead of wall-clock ratios; the timing comparison is now BenchmarkPoolSpreadsLoad.
    • CI runs go test -race -shuffle=on.

    Verified: GOMAXPROCS=2 go test -race -count=3 over the lab, SARIF and pool tests passes, and the full suite passes (also twice with -shuffle=on). The only shuffled failure seen locally was the Windows port-pair bind bug, #204, which is a separate cause.

    A few tests still have upper-bound elapsed-time checks outside this issue's three (rate limiter, cancelled-context resolver, dnsserver). Those are tracked separately.

  3. TMHSDigital commented on Nov 9, 2026

    @TMHSDigital
    OwnerAuthor

    The remaining upper-bound timing checks mentioned above are tracked in #206.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    severity: hightesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions