Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: deterministic rand seed for stable unit test #4447

Merged
merged 2 commits into from
Aug 23, 2022

Conversation

brianolson
Copy link
Contributor

Summary

Putting random data into a bloom filter would sometimes fail the test. Set the random seed so that we have deterministic psuedo-random data.

Test Plan

Ran this for a while with no errors. Used to fail within a few dozen tries.
go test -c -race -o rpcs.test && while logwrapq ./rpcs.test -test.count 50 -test.timeout 5m -test.v -test.run TestSync; do date; done

@brianolson brianolson requested review from cce and algorandskiy August 22, 2022 20:47
@brianolson brianolson self-assigned this Aug 22, 2022
testRand = rand.New(testSource)
}

func cryptoRandBytes(d []byte) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb call it just randBytes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to testRandBytes()

@codecov
Copy link

codecov bot commented Aug 22, 2022

Codecov Report

Merging #4447 (2fe0fd2) into master (e4d6d42) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4447      +/-   ##
==========================================
+ Coverage   55.19%   55.21%   +0.01%     
==========================================
  Files         398      398              
  Lines       50165    50165              
==========================================
+ Hits        27689    27698       +9     
+ Misses      20159    20155       -4     
+ Partials     2317     2312       -5     
Impacted Files Coverage Δ
ledger/tracker.go 73.93% <0.00%> (-0.86%) ⬇️
catchup/service.go 68.64% <0.00%> (-0.75%) ⬇️
ledger/acctupdates.go 69.29% <0.00%> (-0.60%) ⬇️
crypto/merkletrie/node.go 93.48% <0.00%> (+1.86%) ⬆️
crypto/merkletrie/trie.go 68.61% <0.00%> (+2.18%) ⬆️
network/wsPeer.go 68.49% <0.00%> (+3.01%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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

Successfully merging this pull request may close these issues.

2 participants