Skip to content

Commit d56c7e4

Browse files
authored
using the rng created on the test instead the default rand (#5991)
1 parent b704283 commit d56c7e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/ring/ring_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ func TestRing_ShuffleShardWithLookback_CorrectnessWithFuzzy(t *testing.T) {
24422442
t.Run(testName, func(t *testing.T) {
24432443
// Randomise the seed but log it in case we need to reproduce the test on failure.
24442444
seed := time.Now().UnixNano()
2445-
rand.New(rand.NewSource(seed))
2445+
rnd := rand.New(rand.NewSource(seed))
24462446
t.Log("random generator seed:", seed)
24472447

24482448
// Initialise the ring.
@@ -2485,7 +2485,7 @@ func TestRing_ShuffleShardWithLookback_CorrectnessWithFuzzy(t *testing.T) {
24852485
for i := 1; i <= numEvents; i++ {
24862486
currTime = currTime.Add(delayBetweenEvents)
24872487

2488-
switch r := rand.Intn(100); {
2488+
switch r := rnd.Intn(100); {
24892489
case r < 80:
24902490
// Scale up instances by 1.
24912491
instanceID := fmt.Sprintf("instance-%d", nextInstanceID)
@@ -2508,7 +2508,7 @@ func TestRing_ShuffleShardWithLookback_CorrectnessWithFuzzy(t *testing.T) {
25082508

25092509
sort.Strings(instanceIDs)
25102510

2511-
idxToRemove := rand.Intn(len(instanceIDs))
2511+
idxToRemove := rnd.Intn(len(instanceIDs))
25122512
idToRemove := instanceIDs[idxToRemove]
25132513
delete(ringDesc.Ingesters, idToRemove)
25142514

0 commit comments

Comments
 (0)