mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-28 13:27:31 +02:00
test: fix the TestRetryUntil (#14210)
Signed-off-by: He Weiwei <hweiwei@vmware.com>
This commit is contained in:
parent
0b2ef922c0
commit
a0561da5ce
@ -31,7 +31,10 @@ func TestRetryUntil(t *testing.T) {
|
|||||||
return fmt.Errorf("failed")
|
return fmt.Errorf("failed")
|
||||||
}
|
}
|
||||||
assert.Error(RetryUntil(f1, RetryInitialInterval(time.Second), RetryMaxInterval(time.Second), RetryTimeout(time.Second*5)))
|
assert.Error(RetryUntil(f1, RetryInitialInterval(time.Second), RetryMaxInterval(time.Second), RetryTimeout(time.Second*5)))
|
||||||
assert.LessOrEqual(i, 5)
|
// f1 called time 0s - sleep - 1s - sleep - 2s - sleep - 3s - sleep - 4s - sleep - 5s
|
||||||
|
// i after f1 called 1 2 3 4 5 6
|
||||||
|
// the i may be 5 or 6 depend on timeout or default which is seleted by the select statement
|
||||||
|
assert.LessOrEqual(i, 6)
|
||||||
|
|
||||||
f2 := func() error {
|
f2 := func() error {
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user