Fix race tests

This commit is contained in:
binwiederhier
2026-02-23 21:39:07 -05:00
parent 28a436c0d2
commit 9eec72adcc

View File

@@ -2677,10 +2677,14 @@ func TestServer_PublishWhileUpdatingStatsWithLotsOfMessages(t *testing.T) {
require.True(t, time.Since(start) < 100*time.Millisecond) require.True(t, time.Since(start) < 100*time.Millisecond)
log.Info("Done: Publishing message; took %s", time.Since(start).Round(time.Millisecond)) log.Info("Done: Publishing message; took %s", time.Since(start).Round(time.Millisecond))
// Wait for all goroutines // Wait for all Goroutines
waitDuration := 10 * time.Second
if raceEnabled {
waitDuration = 35 * time.Second
}
select { select {
case <-statsChan: case <-statsChan:
case <-time.After(10 * time.Second): case <-time.After(waitDuration):
t.Fatal("Timed out waiting for Go routines") t.Fatal("Timed out waiting for Go routines")
} }
log.Info("Done: Waiting for all locks") log.Info("Done: Waiting for all locks")