Skip to content

Commit c9b0181

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
integration tests: make sure tests using math/rand are seeded
If not every test run will always use the same pattern, possibly defeating the purpose of using random choice in the first place. Signed-off-by: John Mulligan <[email protected]>
1 parent 79eb403 commit c9b0181

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/integration/common_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
package integration
55

66
import (
7+
"math/rand"
78
"os"
89
"strconv"
10+
"time"
911
)
1012

1113
var (
@@ -62,4 +64,9 @@ func init() {
6264
if b, err := strconv.ParseBool(shuffleEnv); b && err == nil {
6365
testShuffleOrder = true
6466
}
67+
68+
// ensure that tests run with a random seed. This can be removed once
69+
// we're certain we run only with Go 1.20+ OR we ought to make this
70+
// settable for test reproduction purposes.
71+
rand.Seed(time.Now().UnixNano())
6572
}

0 commit comments

Comments
 (0)