Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass contexts to OpenStream in tests #31

Merged
merged 1 commit into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/libp2p/go-libp2p-testing
go 1.12

require (
github.com/libp2p/go-libp2p-core v0.7.0
github.com/libp2p/go-libp2p-core v0.8.0
github.com/multiformats/go-multiaddr v0.3.1
go.uber.org/atomic v1.6.0
google.golang.org/grpc v1.31.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6
github.com/libp2p/go-buffer-pool v0.0.2 h1:QNK2iAFa8gjAe1SPz6mHSMuCcjs+X1wlHzeOSqcmlfs=
github.com/libp2p/go-buffer-pool v0.0.2/go.mod h1:MvaB6xw5vOrDl8rYZGLFdKAuk/hRoRZd1Vi32+RXyFM=
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
github.com/libp2p/go-libp2p-core v0.7.0 h1:4a0TMjrWNTZlNvcqxZmrMRDi/NQWrhwO2pkTuLSQ/IQ=
github.com/libp2p/go-libp2p-core v0.7.0/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8=
github.com/libp2p/go-libp2p-core v0.8.0 h1:5K3mT+64qDTKbV3yTdbMCzJ7O6wbNsavAEb8iqBvBcI=
github.com/libp2p/go-libp2p-core v0.8.0/go.mod h1:FfewUH/YpvWbEB+ZY9AQRQ4TAD8sJBt/G1rVvhz5XT8=
github.com/libp2p/go-maddr-filter v0.1.0/go.mod h1:VzZhTXkMucEGGEOSKddrwGiOv0tUhgnKqNEmIAz/bPU=
github.com/libp2p/go-msgio v0.0.6/go.mod h1:4ecVB6d9f4BDSL5fqvPiC4A3KivjWn+Venn/1ALLMWA=
github.com/libp2p/go-openssl v0.0.7 h1:eCAzdLejcNVBzP/iZM9vqHnQm+XyCEbSSIheIPRGNsw=
Expand Down
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