flaky test now sees different error message

This commit is contained in:
Josh Humphries 2019-03-25 10:01:30 -04:00
parent fe97274a1b
commit de97dfa28b
1 changed files with 8 additions and 6 deletions

View File

@ -111,17 +111,19 @@ func TestBrokenTLS_ClientPlainText(t *testing.T) {
// client connection (usually) succeeds since client is not waiting for TLS handshake // client connection (usually) succeeds since client is not waiting for TLS handshake
e, err := createTestServerAndClient(serverCreds, nil) e, err := createTestServerAndClient(serverCreds, nil)
if err != nil { if err != nil {
if strings.Contains(err.Error(), "deadline exceeded") { if strings.Contains(err.Error(), "deadline exceeded") ||
// It is possible that connection never becomes healthy: strings.Contains(err.Error(), "use of closed network connection") {
// It is possible that the connection never becomes healthy:
// 1) grpc connects successfully // 1) grpc connects successfully
// 2) grpc client tries to send HTTP/2 preface and settings frame // 2) grpc client tries to send HTTP/2 preface and settings frame
// 3) server, expecting handshake, closes the connection // 3) server, expecting handshake, closes the connection
// 4) in the client, the write fails, so the connection never // 4) in the client, the write fails, so the connection never
// becomes ready // becomes ready
// More often than not, the connection becomes ready (presumably // The client will attempt to reconnect on transient errors, so
// the write to the socket succeeds before the server closes the // may eventually bump into the connect time limit. This used to
// connection). But when it does not, it is possible to observe // result in a "deadline exceeded" error, but more recent versions
// timeouts when setting up the connection. // of the grpc library report any underlying I/O error instead, so
// we also check for "use of closed network connection".
return return
} }
t.Fatalf("failed to setup server and client: %v", err) t.Fatalf("failed to setup server and client: %v", err)