MCPcopy
hub / github.com/prometheus/prometheus / waitForPrometheus

Method waitForPrometheus

cmd/prometheus/query_log_test.go:71–81  ·  view source on GitHub ↗

waitForPrometheus waits for Prometheus to be ready.

(t *testing.T)

Source from the content-addressed store, hash-verified

69
70// waitForPrometheus waits for Prometheus to be ready.
71func (p *queryLogTest) waitForPrometheus(t *testing.T) {
72 t.Helper()
73 require.Eventually(t, func() bool {
74 r, err := http.Get(fmt.Sprintf("http://%s:%d%s/-/ready", p.host, p.port, p.prefix))
75 if err != nil {
76 return false
77 }
78 r.Body.Close()
79 return r.StatusCode == http.StatusOK
80 }, 20*time.Second, 500*time.Millisecond, "prometheus at %s:%d did not become ready in time", p.host, p.port)
81}
82
83// setQueryLog alters the configuration file to enable or disable the query log,
84// then reloads the configuration if needed.

Callers 1

runMethod · 0.95

Calls 2

GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected