Skip to content

Commit

Permalink
Increased tick time to improve test flakiness (#3158)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cali0707 committed Jun 20, 2023
1 parent 6abfaa2 commit f63f488
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions control-plane/pkg/prober/async_prober_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ func TestAsyncProber(t *testing.T) {
return status == tc.wantStatus
}

require.Eventuallyf(t, probeFunc, 5*time.Second, 100*time.Millisecond, "")
require.Eventuallyf(t, func() bool { return wantRequestCountMin.Load() == 0 }, 5*time.Second, 100*time.Millisecond, "got %d, want 0", wantRequestCountMin.Load())
require.Eventuallyf(t, func() bool { return wantRequeueCountMin.Load() == 0 }, 5*time.Second, 100*time.Millisecond, "got %d, want 0", wantRequeueCountMin.Load())
require.Eventuallyf(t, probeFunc, 5*time.Second, 250*time.Millisecond, "")
require.Eventuallyf(t, func() bool { return wantRequestCountMin.Load() == 0 }, 5*time.Second, 250*time.Millisecond, "got %d, want 0", wantRequestCountMin.Load())
require.Eventuallyf(t, func() bool { return wantRequeueCountMin.Load() == 0 }, 5*time.Second, 250*time.Millisecond, "got %d, want 0", wantRequeueCountMin.Load())
})
}
}
Expand Down Expand Up @@ -297,9 +297,9 @@ func TestAsyncProberRotateCACerts(t *testing.T) {
}

t.Run("one pod - TLS certs before rotation", func(tt *testing.T) {
require.Eventuallyf(t, probeFunc, 5*time.Second, 100*time.Millisecond, "")
require.Eventuallyf(t, func() bool { return wantRequestCountMin.Load() == 1 }, 5*time.Second, 100*time.Millisecond, "got %d, want 1", wantRequestCountMin.Load())
require.Eventuallyf(t, func() bool { return wantRequeueCountMin.Load() == 1 }, 5*time.Second, 100*time.Millisecond, "got %d, want 1", wantRequeueCountMin.Load())
require.Eventuallyf(tt, probeFunc, 5*time.Second, 250*time.Millisecond, "")
require.Eventuallyf(tt, func() bool { return wantRequestCountMin.Load() == 1 }, 5*time.Second, 250*time.Millisecond, "got %d, want 1", wantRequestCountMin.Load())
require.Eventuallyf(tt, func() bool { return wantRequeueCountMin.Load() == 1 }, 5*time.Second, 250*time.Millisecond, "got %d, want 1", wantRequeueCountMin.Load())
})
t.Run("one pod - TLS certs after rotation", func(tt *testing.T) {
prober.RotateRootCaCerts(pointer.String(string(CA2)))
Expand All @@ -308,9 +308,9 @@ func TestAsyncProberRotateCACerts(t *testing.T) {
return &cert, err
}
time.Sleep(time.Second * 10)
require.Eventuallyf(t, probeFunc, 5*time.Second, 100*time.Millisecond, "")
require.Eventuallyf(t, func() bool { return wantRequestCountMin.Load() == 0 }, 5*time.Second, 100*time.Millisecond, "got %d, want 0", wantRequestCountMin.Load())
require.Eventuallyf(t, func() bool { return wantRequeueCountMin.Load() == 0 }, 5*time.Second, 100*time.Millisecond, "got %d, want 0", wantRequeueCountMin.Load())
require.Eventuallyf(tt, probeFunc, 5*time.Second, 250*time.Millisecond, "")
require.Eventuallyf(tt, func() bool { return wantRequestCountMin.Load() == 0 }, 5*time.Second, 250*time.Millisecond, "got %d, want 0", wantRequestCountMin.Load())
require.Eventuallyf(tt, func() bool { return wantRequeueCountMin.Load() == 0 }, 5*time.Second, 250*time.Millisecond, "got %d, want 0", wantRequeueCountMin.Load())
})
}

Expand Down

0 comments on commit f63f488

Please sign in to comment.