MCPcopy
hub / github.com/zalando/skipper / waitForOK

Function waitForOK

redis_test.go:589–609  ·  view source on GitHub ↗
(t *testing.T, url string, timeout time.Duration)

Source from the content-addressed store, hash-verified

587}
588
589func 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}

Calls 2

GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…