Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Brendan Dougherty <[email protected]>
  • Loading branch information
brendar committed Oct 5, 2024
1 parent 8d0f95c commit a9f1a6e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions go/pools/smartconnpool/waitlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestWaitlistExpireWithMultipleWaiters(t *testing.T) {
Expand Down Expand Up @@ -52,11 +53,13 @@ func TestWaitlistExpireWithMultipleWaiters(t *testing.T) {

// Wait for the notified goroutines to finish
timeout := time.After(1 * time.Second)
ticker := time.NewTicker(10 * time.Millisecond)
defer ticker.Stop()
for expireCount.Load() != int32(waiterCount) {
select {
case <-timeout:
t.Fatalf("Timed out waiting for all waiters to expire. Wanted %d, got %d", waiterCount, expireCount.Load())
case <-time.After(10 * time.Millisecond):
require.Failf(t, "Timed out waiting for all waiters to expire", "Wanted %d, got %d", waiterCount, expireCount.Load())
case <-ticker.C:
// try again
}
}
Expand Down

0 comments on commit a9f1a6e

Please sign in to comment.