(t *testing.T, timeout time.Duration, fn func() bool)
| 4133 | } |
| 4134 | |
| 4135 | func waitForCondition(t *testing.T, timeout time.Duration, fn func() bool) { |
| 4136 | t.Helper() |
| 4137 | |
| 4138 | deadline := time.Now().Add(timeout) |
| 4139 | for time.Now().Before(deadline) { |
| 4140 | if fn() { |
| 4141 | return |
| 4142 | } |
| 4143 | time.Sleep(10 * time.Millisecond) |
| 4144 | } |
| 4145 | t.Fatal("timed out waiting for condition") |
| 4146 | } |
| 4147 | |
| 4148 | func waitUntilLeaseExpires(t *testing.T, leaseUntil time.Time, timeout time.Duration) { |
| 4149 | t.Helper() |
no test coverage detected