Browse Source

Merge pull request #31 from libp2p/open-stream-context

pass contexts to OpenStream in tests
merge-testsuite-transports
Marten Seemann 4 years ago
committed by GitHub
parent
commit
a3d1008619
  1. 6
      p2p/transport/testsuite/stream_suite.go
  2. 4
      p2p/transport/testsuite/transport_suite.go

6
p2p/transport/testsuite/stream_suite.go

@ -206,7 +206,7 @@ func SubtestStress(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr,
openStreamAndRW := func(c mux.MuxedConn) {
debugLog(t, "openStreamAndRW %p, %d opt.MsgNum", c, opt.MsgNum)
s, err := c.OpenStream()
s, err := c.OpenStream(context.Background())
if err != nil {
errs <- fmt.Errorf("Failed to create NewStream: %s", err)
return
@ -329,7 +329,7 @@ func SubtestStreamOpenStress(t *testing.T, ta, tb transport.Transport, maddr ma.
go func() {
defer wg.Done()
for i := 0; i < count; i++ {
s, err := connA.OpenStream()
s, err := connA.OpenStream(context.Background())
if err != nil {
t.Error(err)
return
@ -384,7 +384,7 @@ func SubtestStreamReset(t *testing.T, ta, tb transport.Transport, maddr ma.Multi
muxa, err := l.Accept()
checkErr(t, err)
s, err := muxa.OpenStream()
s, err := muxa.OpenStream(context.Background())
if err != nil {
panic(err)
}

4
p2p/transport/testsuite/transport_suite.go

@ -126,7 +126,7 @@ func SubtestBasic(t *testing.T, ta, tb transport.Transport, maddr ma.Multiaddr,
t.Fatal(err)
}
s, err := connA.OpenStream()
s, err := connA.OpenStream(context.Background())
if err != nil {
t.Fatal(err)
}
@ -243,7 +243,7 @@ func SubtestPingPong(t *testing.T, ta, tb transport.Transport, maddr ma.Multiadd
}
for i := 0; i < streams; i++ {
s, err := connB.OpenStream()
s, err := connB.OpenStream(context.Background())
if err != nil {
t.Error(err)
continue

Loading…
Cancel
Save