mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: fix test flake in nats subscribe cleanup (#27238)
This commit is contained in:
@@ -589,9 +589,13 @@ func TestSubscribeError(t *testing.T) {
|
||||
})
|
||||
require.ErrorIs(t, err, assert.AnError)
|
||||
require.Nil(t, cancel)
|
||||
ps.mu.Lock()
|
||||
defer ps.mu.Unlock()
|
||||
require.Empty(t, ps.subscriptions)
|
||||
// subscribeDone closes before failed-group cleanup to avoid a
|
||||
// lock-order deadlock, so SubscribeWithErr may return first.
|
||||
require.Eventually(t, func() bool {
|
||||
ps.mu.Lock()
|
||||
defer ps.mu.Unlock()
|
||||
return len(ps.subscriptions) == 0
|
||||
}, testutil.WaitShort, testutil.IntervalFast)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user