Skip to content

Commit db65bf2

Browse files
authored
chore(tests): fix timing issue in jitter tests (#2283)
1 parent 116414e commit db65bf2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

router/pkg/controlplane/poll_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ func Test_Poller(t *testing.T) {
6868
i, actualInterval, expectedMinInterval)
6969

7070
// Each interval should be at most interval + maxJitter
71-
assert.LessOrEqual(t, actualInterval, expectedMaxInterval,
71+
// a small delay to account for system scheduling delays
72+
expectedInterval := expectedMaxInterval + 10*time.Millisecond
73+
assert.LessOrEqual(t, actualInterval, expectedInterval,
7274
"execution %d: actual interval %v should be <= maximum interval %v",
73-
i, actualInterval, expectedMaxInterval)
75+
i, actualInterval, expectedInterval)
7476

7577
t.Logf("execution %d: interval = %v (expected: %v to %v)",
7678
i, actualInterval, expectedMinInterval, expectedMaxInterval)

0 commit comments

Comments
 (0)