From 87525e88377a013c362b8659962e1a39bbefbbdd Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Wed, 15 Feb 2023 00:58:00 +0000 Subject: [PATCH] Fix flakines in autorelay and basic_host --- p2p/host/autorelay/autorelay_test.go | 2 +- p2p/host/basic/basic_host_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/p2p/host/autorelay/autorelay_test.go b/p2p/host/autorelay/autorelay_test.go index 3cb6def61c..62a678b0eb 100644 --- a/p2p/host/autorelay/autorelay_test.go +++ b/p2p/host/autorelay/autorelay_test.go @@ -144,7 +144,7 @@ func TestSingleCandidate(t *testing.T) { ) defer h.Close() - require.Eventually(t, func() bool { return numRelays(h) > 0 }, 3*time.Second, 100*time.Millisecond) + require.Eventually(t, func() bool { return numRelays(h) > 0 }, 30*time.Second, 100*time.Millisecond) // test that we don't add any more relays require.Never(t, func() bool { return numRelays(h) > 1 }, 200*time.Millisecond, 50*time.Millisecond) require.Equal(t, 1, counter, "expected the peer source callback to only have been called once") diff --git a/p2p/host/basic/basic_host_test.go b/p2p/host/basic/basic_host_test.go index d73da15c2d..967b2077be 100644 --- a/p2p/host/basic/basic_host_test.go +++ b/p2p/host/basic/basic_host_test.go @@ -250,7 +250,7 @@ func getHostPair(t *testing.T) (host.Host, host.Host) { require.NoError(t, err) h2.Start() - ctx, cancel := context.WithTimeout(context.Background(), time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() h2pi := h2.Peerstore().PeerInfo(h2.ID()) require.NoError(t, h1.Connect(ctx, h2pi))