From 7e49f524485571baad60a4524b500fc720a51d93 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Fri, 22 Apr 2022 15:07:53 +0100 Subject: [PATCH] fix flaky TestResourceManagerAcceptStream test --- p2p/net/swarm/swarm_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/p2p/net/swarm/swarm_test.go b/p2p/net/swarm/swarm_test.go index c7db03e994..3bb6645740 100644 --- a/p2p/net/swarm/swarm_test.go +++ b/p2p/net/swarm/swarm_test.go @@ -535,7 +535,8 @@ func TestResourceManagerAcceptStream(t *testing.T) { str, err := s1.NewStream(context.Background(), s2.LocalPeer()) require.NoError(t, err) _, err = str.Write([]byte("foobar")) - require.NoError(t, err) - _, err = str.Read([]byte{0}) + if err == nil { + _, err = str.Read([]byte{0}) + } require.EqualError(t, err, "stream reset") }