(t *testing.T, url string, timeout time.Duration)
| 587 | } |
| 588 | |
| 589 | func waitForOK(t *testing.T, url string, timeout time.Duration) { |
| 590 | t.Helper() |
| 591 | |
| 592 | to := time.After(timeout) |
| 593 | for { |
| 594 | rsp, err := http.DefaultClient.Get(url) |
| 595 | if err == nil { |
| 596 | rsp.Body.Close() |
| 597 | if rsp.StatusCode == http.StatusOK { |
| 598 | return |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | select { |
| 603 | case <-to: |
| 604 | t.Fatalf("timeout waiting for %s", url) |
| 605 | default: |
| 606 | time.Sleep(timeout / 10) |
| 607 | } |
| 608 | } |
| 609 | } |
no test coverage detected
searching dependent graphs…