Skip to content

Count dialed queries in TestCheckWildcardInconclusive (#439) - #440

Open
nova-loop wants to merge 1 commit into
TMHSDigital:mainfrom
nova-loop:test/wildcard-inconclusive-dials
Open

nova-loop wants to merge 1 commit into
TMHSDigital:mainfrom
nova-loop:test/wildcard-inconclusive-dials

Conversation

@nova-loop

Copy link
Copy Markdown

Description

TestCheckWildcardInconclusive/timeout counted the packets that the test server received. With a 100 ms per-attempt timeout, an attempt on a loaded machine can expire before its packet is written. The server then sees one query even though the probe was retried. The test now counts queries on the client side with the existing WithQueryCounter hook, which NewResolver's Dial increments once per query it dials (retries included), and asserts that count is at least 2. Production code is unchanged.

Related Issue

Closes #439

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvements
  • Test updates

Checklist

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project
  • I have added/updated appropriate comments to the code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)

Ethical Considerations

  • This change maintains or improves the security controls in the tool
  • This change follows the educational/legitimate security testing focus of the project
  • I have considered potential misuse cases and taken appropriate steps to prevent them

Additional Information

Tested on Linux with Go 1.27:

  • go test -cpu 1 -count=20 -run TestCheckWildcardInconclusive ./internal/dns passes while go test ./... -count=3 runs in parallel.
  • go test ./... and go vet ./internal/dns are clean.
  • To check that the assertion still catches a missing retry, I set Attempts: 1 temporarily. The timeout case then fails with queries dialed = 1, want >= 2.

I did not reproduce the original Windows flake.

This change was prepared with AI assistance and reviewed before submission.

The timeout case counted packets the test server received. On a loaded
machine an attempt's 100 ms can expire before its packet is written, so
the server saw one query although the probe was retried. Count the
queries the client dials with WithQueryCounter instead.

Closes TMHSDigital#439

This branch has not been deployed

No deployments
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.

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

1 participant