From 5a9b740acb419afd892a8e37e14384f4ef65972f Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Wed, 27 Jan 2021 22:31:31 +0100 Subject: [PATCH] test: fix TestSwitchAcceptRoutine by ignoring spurious error (#6001) Another fix for `TestSwitchAcceptRoutine` following from #6000, since the `SetDeadline()` call also errors when the connection has been closed. --- p2p/switch_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/p2p/switch_test.go b/p2p/switch_test.go index 14ae01aed..432586cfe 100644 --- a/p2p/switch_test.go +++ b/p2p/switch_test.go @@ -642,8 +642,7 @@ func TestSwitchAcceptRoutine(t *testing.T) { require.NoError(t, err) // check conn is closed one := make([]byte, 1) - err = conn.SetReadDeadline(time.Now().Add(10 * time.Millisecond)) - require.NoError(t, err) + _ = conn.SetReadDeadline(time.Now().Add(10 * time.Millisecond)) _, err = conn.Read(one) assert.Error(t, err) assert.Equal(t, cfg.MaxNumInboundPeers, sw.Peers().Size())