Skip to content

TestCheckWildcardInconclusive/timeout can flake under load: counts packets, not attempts #439

Closed

Description

@TMHSDigital

Summary

TestCheckWildcardInconclusive/timeout failed once during a full go test -shuffle=on ./... run on Windows and passed on 5 reruns alone. With a 100 ms per-attempt timeout and a server that drops the query, a loaded machine can let an attempt time out before its packet is written, so the server counts one query instead of two.

Where

  • internal/dns/resolver_test.go:117 (TestCheckWildcardInconclusive), the timeout case
  • internal/dns/resolver_test.go:127 (timeout := 100 * time.Millisecond)
  • internal/dns/resolver_test.go:138 (if got := srv.Queries(); got < 2)

Details

Failure seen in a local full-suite run while working on #432 (before 7ea4e94):

--- FAIL: TestCheckWildcardInconclusive/timeout (0.26s)
    resolver_test.go:139: queries = 1, want >= 2 (the probe retried)

The test checks that the probe was retried by counting packets the test server received. That count depends on the client getting each packet onto the wire within its 100 ms attempt. Under a full parallel suite on Windows, the second attempt's deadline can pass before the write happens. The probe was still retried, but the server never saw the second query.

Impact

An occasional red CI run or local gate that has nothing to do with the change under test. Low severity, but it costs a rerun and trust in the suite.

Steps to reproduce

  1. On a loaded machine, run go test -shuffle=on ./... a few times.
  2. Occasionally TestCheckWildcardInconclusive/timeout fails with queries = 1.
  3. go test ./internal/dns -run TestCheckWildcardInconclusive -count=5 alone passes.

Suggested fix

Count attempts on the client side instead of packets on the server, for example with a resolver hook or a dial counter that sees each attempt start. Alternatively, raise the per-attempt timeout for this case (the test only needs the probe to fail, not to fail fast), or wait for the server to report two queries before asserting.

Acceptance criteria

  • The test asserts the retry without depending on packets reaching the server within 100 ms
  • go test -count=20 -run TestCheckWildcardInconclusive ./internal/dns passes under -cpu 1 with a parallel suite running

Getting started


Filed by repo-audit/fix-issues at e821702. Severity: low. Effort: S. audit-key: testing|internal/dns/resolver_test.go|TestCheckWildcardInconclusive

Activity

  1. added
    good first issue
    testing
    severity: low
    on Nov 19, 2026
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

    good first issueseverity: lowtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions