MCPcopy
hub / github.com/nats-io/nats.go / checkFor

Function checkFor

jetstream/test/helper_test.go:325–339  ·  view source on GitHub ↗
(t *testing.T, totalWait, sleepDur time.Duration, f func() error)

Source from the content-addressed store, hash-verified

323}
324
325func checkFor(t *testing.T, totalWait, sleepDur time.Duration, f func() error) {
326 t.Helper()
327 timeout := time.Now().Add(totalWait)
328 var err error
329 for time.Now().Before(timeout) {
330 err = f()
331 if err == nil {
332 return
333 }
334 time.Sleep(sleepDur)
335 }
336 if err != nil {
337 t.Fatal(err.Error())
338 }
339}

Calls 2

AddMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected