Skip to content

Fix flaky tests fails due inconsistent RNG usage#140

Open
asciimoth wants to merge 2 commits into
WireGuard:masterfrom
asciimoth:master
Open

Fix flaky tests fails due inconsistent RNG usage#140
asciimoth wants to merge 2 commits into
WireGuard:masterfrom
asciimoth:master

Conversation

@asciimoth
Copy link
Copy Markdown

Summary

TestTrieRandom seeded a local RNG for generated addresses, but still used the package-global math/rand helpers for CIDR and peer selection. Under go test -race with repeated runs, that left the test only partially deterministic and made the slow reference router more likely to hit timeout-heavy paths which leads to test fails in like 1/100 runs.

This change switches the remaining random choices in device/allowedips_rand_test.go to the existing local seeded RNG so the test uses a single deterministic source.

Scope

  • update TestTrieRandom to use rng.Intn(...) for CIDR and peer selection
  • leave production code unchanged

Typos

I've also fixed some minor typos:

  • HandshakeInitationRate -> HandshakeInitiationRate
  • mis-parse -> miss-parse

Signed-off-by: AsciiMoth <ascii@moth.contact>
HandshakeInitationRate -> HandshakeInitiationRate
mis-parse -> miss-parse

Signed-off-by: AsciiMoth <ascii@moth.contact>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant