(maxWait time.Duration, phrase string)
| 5082 | } |
| 5083 | |
| 5084 | func awaitLogOutput(maxWait time.Duration, phrase string) { |
| 5085 | pb := []byte(phrase) |
| 5086 | |
| 5087 | timer := time.NewTimer(maxWait) |
| 5088 | defer timer.Stop() |
| 5089 | wakeup := make(chan bool, 1) |
| 5090 | for { |
| 5091 | if logOutputHasContents(pb, wakeup) { |
| 5092 | return |
| 5093 | } |
| 5094 | select { |
| 5095 | case <-timer.C: |
| 5096 | // Too slow. Oh well. |
| 5097 | return |
| 5098 | case <-wakeup: |
| 5099 | } |
| 5100 | } |
| 5101 | } |
| 5102 | |
| 5103 | func logOutputHasContents(v []byte, wakeup chan<- bool) bool { |
| 5104 | testLogOutput.mu.Lock() |
no test coverage detected