diff --git a/command/agent/http_test.go b/command/agent/http_test.go index 5521b74db..db2d1e825 100644 --- a/command/agent/http_test.go +++ b/command/agent/http_test.go @@ -1006,6 +1006,12 @@ func TestHTTPServer_Limits_OK(t *testing.T) { }(i) } + select { + case err := <-errCh: + t.Fatalf("unexpected error from connection prior to limit: %T %v", err, err) + case <-time.After(500 * time.Millisecond): + } + // Assert a new connection is dropped conn, err := net.DialTimeout("tcp", addr, 1*time.Second) require.NoError(t, err) @@ -1016,7 +1022,9 @@ func TestHTTPServer_Limits_OK(t *testing.T) { conn.SetReadDeadline(deadline) n, err := conn.Read(buf) require.Zero(t, n) - require.Equal(t, io.EOF, err) + + // Soft-fail as following assertion helps with debugging + assert.Equal(t, io.EOF, err) // Assert existing connections are ok require.Len(t, errCh, 0)