mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
tolerate clock change in throttle testing
This commit is contained in:
parent
de59ede6b2
commit
e10d4cbd2e
@ -64,7 +64,8 @@ func TestMultithreadedThrottling(t *testing.T) {
|
|||||||
// record wall time
|
// record wall time
|
||||||
endTime := time.Now()
|
endTime := time.Now()
|
||||||
|
|
||||||
if duration := endTime.Sub(startTime); duration < time.Second {
|
// tolerate a 1% clock change because these things happen
|
||||||
|
if duration := endTime.Sub(startTime); duration < (time.Second * 99 / 100) {
|
||||||
// We shouldn't be able to get 100 tokens out of the bucket in less than 1 second of wall clock time, no matter what
|
// We shouldn't be able to get 100 tokens out of the bucket in less than 1 second of wall clock time, no matter what
|
||||||
t.Errorf("Expected it to take at least 1 second to get 100 tokens, took %v", duration)
|
t.Errorf("Expected it to take at least 1 second to get 100 tokens, took %v", duration)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user