diff --git a/toxics/reset_peer_test.go b/toxics/reset_peer_test.go index ca6a1960..da799ab3 100644 --- a/toxics/reset_peer_test.go +++ b/toxics/reset_peer_test.go @@ -52,9 +52,12 @@ func addToxicAndWritePayload(t *testing.T, conn net.Conn, proxy *toxiproxy.Proxy func checkConnectionState(t *testing.T, conn net.Conn) { tmp := make([]byte, 10) _, err := conn.Read(tmp) - opErr, _ := err.(*net.OpError) - syscallErr, _ := opErr.Err.(*os.SyscallError) - if !(syscallErr.Err == syscall.ECONNRESET) { + if opErr, ok := err.(*net.OpError); ok { + syscallErr, _ := opErr.Err.(*os.SyscallError) + if !(syscallErr.Err == syscall.ECONNRESET) { + t.Error("Expected: upstream - connection reset by peer. Got:", err) + } + } else { t.Error("Expected: upstream - connection reset by peer. Got:", err) } _, err = conn.Read(tmp)