Skip to content
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.

Commit

Permalink
fix flaky TestAcceptQueueBacklogged test
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Dec 12, 2021
1 parent a2b5749 commit acbe092
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ func TestAcceptQueueBacklogged(t *testing.T) {
doDial := func() {
conn, err := dial(t, upgrader, ln.Multiaddr(), id)
errCh <- err
if conn != nil {
_ = conn.Close()
}
t.Cleanup(func() { conn.Close() })
}

for i := 0; i < st.AcceptQueueLength; i++ {
Expand All @@ -309,7 +307,7 @@ func TestAcceptQueueBacklogged(t *testing.T) {
// accept a single connection. Now the new connection should be set up, and fill the queue again
conn, err := ln.Accept()
require.NoError(err)
_ = conn.Close()
require.NoError(conn.Close())

require.Eventually(func() bool { return len(errCh) == st.AcceptQueueLength+1 }, 2*time.Second, 100*time.Millisecond)
}
Expand Down

0 comments on commit acbe092

Please sign in to comment.