Skip to content

Commit

Permalink
tls: fix error reporting in TestInvalidCerts
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed May 25, 2022
1 parent 336d093 commit 8ab14d6
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions p2p/security/tls/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,26 +482,24 @@ func TestInvalidCerts(t *testing.T) {
_, err := conn.Read([]byte{0})
clientErrChan <- err
}()
var clientErr error
select {
case clientErr = <-clientErrChan:
case err := <-clientErrChan:
require.Error(t, err)
if err.Error() != "remote error: tls: error decrypting message" &&
err.Error() != "remote error: tls: bad certificate" {
t.Fatalf("unexpected error: %s", err.Error())
}
case <-time.After(250 * time.Millisecond):
t.Fatal("expected the server handshake to return")
}
require.Error(t, clientErr)
if clientErr.Error() != "remote error: tls: error decrypting message" &&
clientErr.Error() != "remote error: tls: bad certificate" {
t.Fatalf("unexpected error: %s", err.Error())
}

var serverErr error
select {
case serverErr = <-serverErrChan:
case err := <-serverErrChan:
require.Error(t, err)
tr.checkErr(t, err)
case <-time.After(250 * time.Millisecond):
t.Fatal("expected the server handshake to return")
}
require.Error(t, serverErr)
tr.checkErr(t, serverErr)
})

t.Run(fmt.Sprintf("server offending: %s", tr.name), func(t *testing.T) {
Expand Down

0 comments on commit 8ab14d6

Please sign in to comment.