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

Function waitFor

test/drain_test.go:128–142  ·  view source on GitHub ↗
(t *testing.T, totalWait, sleepDur time.Duration, f func() error)

Source from the content-addressed store, hash-verified

126}
127
128func waitFor(t *testing.T, totalWait, sleepDur time.Duration, f func() error) {
129 t.Helper()
130 timeout := time.Now().Add(totalWait)
131 var err error
132 for time.Now().Before(timeout) {
133 err = f()
134 if err == nil {
135 return
136 }
137 time.Sleep(sleepDur)
138 }
139 if err != nil {
140 t.Fatal(err.Error())
141 }
142}
143
144func TestDrainUnSubs(t *testing.T) {
145 s := RunDefaultServer()

Callers 6

TestDrainUnSubsFunction · 0.85
TestDrainSlowSubscriberFunction · 0.85
checkNoGoroutineLeakFunction · 0.85

Calls 2

AddMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected