MCPcopy Create free account
hub / github.com/IBM/sarama / waitFor

Method waitFor

functional_consumer_group_java_interop_test.go:117–133  ·  view source on GitHub ↗
(cond func(map[string][]int32) bool, what string)

Source from the content-addressed store, hash-verified

115}
116
117func (a *assignmentTracker) waitFor(cond func(map[string][]int32) bool, what string) {
118 a.t.Helper()
119 deadline := time.NewTimer(90 * time.Second)
120 defer deadline.Stop()
121 for !cond(a.Owned()) {
122 select {
123 case <-a.changed:
124 case <-a.done:
125 a.mu.Lock()
126 reason := a.stopReason
127 a.mu.Unlock()
128 require.FailNow(a.t, fmt.Sprintf("member %s %s while waiting %s%s", a.name, reason, what, a.failureDetail()))
129 case <-deadline.C:
130 require.FailNow(a.t, fmt.Sprintf("timed out waiting for member %s %s, owns %v%s", a.name, what, a.Owned(), a.failureDetail()))
131 }
132 }
133}
134
135func (a *assignmentTracker) waitUntilJoined() {
136 a.t.Helper()

Callers 2

waitUntilJoinedMethod · 0.95

Calls 4

OwnedMethod · 0.95
failureDetailMethod · 0.95
HelperMethod · 0.80
StopMethod · 0.80

Tested by

no test coverage detected