MCPcopy Create free account
hub / github.com/encodeous/nylon / WaitForStatus

Method WaitForStatus

e2e/harness.go:199–213  ·  view source on GitHub ↗
(t *testing.T, nodeName string, check func(*protocol.StatusResponse) bool)

Source from the content-addressed store, hash-verified

197 h.waitFor(nodeName, SourceStdout, pattern, true)
198}
199func (h *Harness) WaitForStatus(t *testing.T, nodeName string, check func(*protocol.StatusResponse) bool) {
200 t.Helper()
201 start := time.Now()
202 for {
203 if time.Since(start) > WaitTimeout {
204 stdout, _, _ := h.Exec(nodeName, []string{"nylon", "status", "-i", "nylon0", "--json"})
205 h.t.Fatalf("timed out waiting for status predicate in node %s. Current status:\n%s", nodeName, stdout)
206 }
207 status, err := h.ReadStatus(nodeName)
208 if err == nil && check(status) {
209 return
210 }
211 time.Sleep(500 * time.Millisecond)
212 }
213}
214
215func (h *Harness) ReadStatus(nodeName string) (*protocol.StatusResponse, error) {
216 stdout, _, err := h.Exec(nodeName, []string{"nylon", "status", "-i", "nylon0", "--json"})

Callers 2

TestHealthcheckPingFunction · 0.95
TestHealthcheckHTTPFunction · 0.95

Calls 2

ExecMethod · 0.95
ReadStatusMethod · 0.95

Tested by 2

TestHealthcheckPingFunction · 0.76
TestHealthcheckHTTPFunction · 0.76