diff --git a/p2p/transport/testsuite/stream_suite.go b/p2p/transport/testsuite/stream_suite.go index f7172b4636..b1db0bc640 100644 --- a/p2p/transport/testsuite/stream_suite.go +++ b/p2p/transport/testsuite/stream_suite.go @@ -55,7 +55,7 @@ type Options struct { } func fullClose(t *testing.T, s mux.MuxedStream) { - if err := s.Close(); err != nil { + if err := s.CloseWrite(); err != nil { t.Error(err) s.Reset() return @@ -67,6 +67,9 @@ func fullClose(t *testing.T, s mux.MuxedStream) { if len(b) != 0 { t.Error("expected to be done reading") } + if err := s.Close(); err != nil { + t.Error(err) + } } func randBuf(size int) []byte { diff --git a/p2p/transport/testsuite/transport_suite.go b/p2p/transport/testsuite/transport_suite.go index 234c43c495..0b57f00a0a 100644 --- a/p2p/transport/testsuite/transport_suite.go +++ b/p2p/transport/testsuite/transport_suite.go @@ -141,8 +141,8 @@ func SubtestBasic(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, t.Fatalf("failed to write enough data (a->b)") return } - err = s.Close() - if err != nil { + + if err = s.CloseWrite(); err != nil { t.Fatal(err) return } @@ -155,6 +155,11 @@ func SubtestBasic(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, if !bytes.Equal(testData, buf) { t.Errorf("expected %s, got %s", testData, buf) } + + if err = s.Close(); err != nil { + t.Fatal(err) + return + } } func SubtestPingPong(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr, peerA peer.ID) { @@ -265,7 +270,10 @@ func SubtestPingPong(t *testing.T, ta, tb transport.Transport, maddr ma.Multiadd t.Error("failed to write enough data (a->b)") return } - s.Close() + if err = s.CloseWrite(); err != nil { + t.Fatal(err) + return + } ret, err := ioutil.ReadAll(s) if err != nil { @@ -276,6 +284,11 @@ func SubtestPingPong(t *testing.T, ta, tb transport.Transport, maddr ma.Multiadd if !bytes.Equal(data, ret) { t.Errorf("expected %q, got %q", string(data), string(ret)) } + + if err = s.Close(); err != nil { + t.Fatal(err) + return + } }(i) } wg.Wait()