Skip to content

Commit d698d91

Browse files
committed
test: fix occasional panic sending on a closed channel
The panic obfuscated the actual reason the test failed.
1 parent f418a07 commit d698d91

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

core/server/sync_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ func TestSync(t *testing.T) {
118118

119119
go func() {
120120
_, err := c.SyncFluxObject(ctx, msg)
121-
done <- err
121+
select {
122+
case <-done:
123+
return
124+
default:
125+
done <- err
126+
}
122127
}()
123128

124129
ticker := time.NewTicker(500 * time.Millisecond)

0 commit comments

Comments
 (0)