Skip to content

Commit fddeb00

Browse files
committed
test(cli/clitest): Fix panic in Wait
1 parent e2a7448 commit fddeb00

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cli/clitest/clitest.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,14 @@ func StartWithWaiter(t *testing.T, inv *clibase.Invocation) *ErrorWaiter {
231231
errCh <- err
232232
}()
233233

234+
ew := &ErrorWaiter{c: errCh, t: t}
235+
234236
// Don't exit test routine until server is done.
235237
t.Cleanup(func() {
236238
cancel()
237239
cleaningUp.Store(true)
240+
_ = ew.Wait() // We must allow Wait to deplete errCh because if we deplete it here Wait will panic.
238241
<-errCh
239242
})
240-
return &ErrorWaiter{c: errCh, t: t}
243+
return ew
241244
}

0 commit comments

Comments
 (0)