Skip to content

Commit

Permalink
pass contexts to OpenStream in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Dec 17, 2020
1 parent ec46cf3 commit 62c944d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions suites/mux/muxer_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package test

import (
"bytes"
"context"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -138,7 +139,7 @@ func SubtestSimpleWrite(t *testing.T, tr mux.Multiplexer) {
go c1.AcceptStream()

log("creating stream")
s1, err := c1.OpenStream()
s1, err := c1.OpenStream(context.Background())
checkErr(t, err)
defer s1.Close()

Expand Down Expand Up @@ -211,7 +212,7 @@ func SubtestStress(t *testing.T, opt Options) {
openStreamAndRW := func(c mux.MuxedConn) {
log("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
Expand Down Expand Up @@ -339,7 +340,7 @@ func SubtestStreamOpenStress(t *testing.T, tr mux.Multiplexer) {
stress := func() {
defer wg.Done()
for i := 0; i < count; i++ {
s, err := muxa.OpenStream()
s, err := muxa.OpenStream(context.Background())
if err != nil {
t.Error(err)
return
Expand Down Expand Up @@ -422,7 +423,7 @@ func SubtestStreamReset(t *testing.T, tr mux.Multiplexer) {
t.Error(err)
return
}
s, err := muxa.OpenStream()
s, err := muxa.OpenStream(context.Background())
if err != nil {
t.Error(err)
return
Expand Down
6 changes: 3 additions & 3 deletions suites/transport/stream_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions suites/transport/transport_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 62c944d

Please sign in to comment.