(exp string, n int, to time.Duration)
| 124 | } |
| 125 | |
| 126 | func (l *testLog) WaitForN(exp string, n int, to time.Duration) error { |
| 127 | timeout := time.After(to) |
| 128 | ticker := time.NewTicker(10 * time.Millisecond) |
| 129 | defer ticker.Stop() |
| 130 | |
| 131 | for { |
| 132 | select { |
| 133 | case <-timeout: |
| 134 | return fmt.Errorf("timeout waiting for log entry: %s", exp) |
| 135 | case <-ticker.C: |
| 136 | if l.Count(exp) >= n { |
| 137 | return nil |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | func (l *testLog) WaitFor(exp string, to time.Duration) error { |
| 144 | return l.WaitForN(exp, 1, to) |
no test coverage detected