MCPcopy
hub / github.com/grpc/grpc-go / awaitLogOutput

Function awaitLogOutput

test/end2end_test.go:5084–5101  ·  view source on GitHub ↗
(maxWait time.Duration, phrase string)

Source from the content-addressed store, hash-verified

5082}
5083
5084func 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
5103func logOutputHasContents(v []byte, wakeup chan<- bool) bool {
5104 testLogOutput.mu.Lock()

Callers 1

awaitNewConnLogOutputFunction · 0.85

Calls 3

StopMethod · 0.95
logOutputHasContentsFunction · 0.85
NewTimerMethod · 0.80

Tested by

no test coverage detected