Skip to content

Commit

Permalink
test(hare): add cleanup (#6227)
Browse files Browse the repository at this point in the history
## Motivation

Adds a missing cleanup to drain goroutines on test completion.
  • Loading branch information
acud committed Aug 7, 2024
1 parent 83b0499 commit a79bdbb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hare4/hare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,15 @@ func (cl *lockstepCluster) waitStopped() {
// drainInteractiveMessages will make sure that the channels that signal
// that interactive messages came in on the tracer are read from.
func (cl *lockstepCluster) drainInteractiveMessages() {
done := make(chan struct{})
cl.t.Cleanup(func() { close(done) })
for _, n := range cl.nodes {
go func() {
for {
select {
case <-n.tracer.compactReq:
case <-n.tracer.compactResp:
case <-done:
}
}
}()
Expand Down

0 comments on commit a79bdbb

Please sign in to comment.