Skip to content

Commit

Permalink
test: fix test when using a net.Conn
Browse files Browse the repository at this point in the history
  • Loading branch information
schmichael committed Aug 15, 2024
1 parent 79d8b58 commit bb343dc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,20 @@ func TestOpenStreamTimeout(t *testing.T) {
// Since no ACKs are received, the stream and session should be closed.
time.Sleep(timeout * 5)

if !clientLogs.match([]string{"[ERR] yamux: aborted stream open (destination=yamux:remote): i/o deadline reached"}) {
t.Fatalf("server log incorect: %v", clientLogs.logs())
// Support multiple underlying connection types
var dest string
switch conn := client.conn.(type) {
case net.Conn:
dest = conn.RemoteAddr().String()
case *pipeConn:
dest = "yamux:remote"
default:
t.Fatalf("unsupported connection type %T - please update test", conn)
}
exp := fmt.Sprintf("[ERR] yamux: aborted stream open (destination=%s): i/o deadline reached", dest)

if !clientLogs.match([]string{exp}) {
t.Fatalf("server log incorect: %v\nexpected: %v", clientLogs.logs(), exp)
}

s.stateLock.Lock()
Expand Down

0 comments on commit bb343dc

Please sign in to comment.