Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonQ committed Feb 10, 2023
1 parent 3a2ae19 commit a2c8d13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,16 @@ func (c *StubClientImpl) OnError(err error) {
}

func waitFor(check func() error) error {
timeout := 5 * time.Minute
started := time.Now()
for {
err := check()
if err == nil {
return nil
}
if time.Now().Sub(started) >= 5*time.Second {
return fmt.Errorf("check timed out after 1 second: %s", err)
if time.Now().Sub(started) >= timeout {
return fmt.Errorf("check timed out after %s: %s",
5*time.Minute, err)
}
time.Sleep(10 * time.Millisecond)
}
Expand Down

0 comments on commit a2c8d13

Please sign in to comment.