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.
This commit is contained in:
Erik Grinaker
2021-01-27 21:31:31 +00:00
committed by GitHub
parent aead4ab555
commit 5a9b740acb
+1 -2
View File
@@ -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())