WaitForCondition wait for predicate to execute to true
( t testing.TB, predicate func() (bool, string), timeout time.Duration, delay time.Duration, )
| 454 | |
| 455 | // WaitForCondition wait for predicate to execute to true |
| 456 | func (c *CLI) WaitForCondition( |
| 457 | t testing.TB, |
| 458 | predicate func() (bool, string), |
| 459 | timeout time.Duration, |
| 460 | delay time.Duration, |
| 461 | ) { |
| 462 | t.Helper() |
| 463 | checkStopped := func(logt poll.LogT) poll.Result { |
| 464 | pass, description := predicate() |
| 465 | if !pass { |
| 466 | return poll.Continue("Condition not met: %q", description) |
| 467 | } |
| 468 | return poll.Success() |
| 469 | } |
| 470 | poll.WaitOn(t, checkStopped, poll.WithDelay(delay), poll.WithTimeout(timeout)) |
| 471 | } |
| 472 | |
| 473 | // Lines split output into lines |
| 474 | func Lines(output string) []string { |
no outgoing calls