(t *testing.T, totalWait, sleepDur time.Duration, f func() error)
| 126 | } |
| 127 | |
| 128 | func 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 | |
| 144 | func TestDrainUnSubs(t *testing.T) { |
| 145 | s := RunDefaultServer() |
no test coverage detected