Skip to content

Commit

Permalink
using the rng created on the test instead the default rand (cortexpro…
Browse files Browse the repository at this point in the history
  • Loading branch information
alanprot authored May 31, 2024
1 parent b704283 commit d56c7e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/ring/ring_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ func TestRing_ShuffleShardWithLookback_CorrectnessWithFuzzy(t *testing.T) {
t.Run(testName, func(t *testing.T) {
// Randomise the seed but log it in case we need to reproduce the test on failure.
seed := time.Now().UnixNano()
rand.New(rand.NewSource(seed))
rnd := rand.New(rand.NewSource(seed))
t.Log("random generator seed:", seed)

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

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

sort.Strings(instanceIDs)

idxToRemove := rand.Intn(len(instanceIDs))
idxToRemove := rnd.Intn(len(instanceIDs))
idToRemove := instanceIDs[idxToRemove]
delete(ringDesc.Ingesters, idToRemove)

Expand Down

0 comments on commit d56c7e4

Please sign in to comment.