From 22322fe7df6b4e1bcf6338e00abdd22252b908e9 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Tue, 18 Jun 2024 16:08:00 -0700 Subject: [PATCH] [e2e tests] fix regex for connection failures to catch a missed case (#36969) Closes #36969 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36969 from markdroth:e2e_test_regex_fix 043e5fdadbf85efdd9886224b1743f3a9b7e5e4c PiperOrigin-RevId: 644540986 --- test/cpp/end2end/client_lb_end2end_test.cc | 33 ++++++++++---------- test/cpp/end2end/xds/xds_end2end_test_lib.cc | 33 ++++++++++---------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 136087b8dd0..d492d1f0aa6 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -580,22 +580,23 @@ class ClientLbEnd2endTest : public ::testing::Test { } static std::string MakeConnectionFailureRegex(absl::string_view prefix) { - return absl::StrCat(prefix, - "; last error: (UNKNOWN|UNAVAILABLE): " - // IP address - "(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " - // Prefixes added for context - "(Failed to connect to remote host: )?" - "(Timeout occurred: )?" - // Syscall - "((connect|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?" - // strerror() output or other message - "(Connection refused" - "|Connection reset by peer" - "|Socket closed" - "|FD shutdown)" - // errno value - "( \\([0-9]+\\))?"); + return absl::StrCat( + prefix, + "; last error: (UNKNOWN|UNAVAILABLE): " + // IP address + "(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " + // Prefixes added for context + "(Failed to connect to remote host: )?" + "(Timeout occurred: )?" + // Syscall + "((connect|sendmsg|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?" + // strerror() output or other message + "(Connection refused" + "|Connection reset by peer" + "|Socket closed" + "|FD shutdown)" + // errno value + "( \\([0-9]+\\))?"); } const std::string server_host_; diff --git a/test/cpp/end2end/xds/xds_end2end_test_lib.cc b/test/cpp/end2end/xds/xds_end2end_test_lib.cc index 2acf69ff1a0..9865a3a88de 100644 --- a/test/cpp/end2end/xds/xds_end2end_test_lib.cc +++ b/test/cpp/end2end/xds/xds_end2end_test_lib.cc @@ -836,22 +836,23 @@ void XdsEnd2endTest::SetProtoDuration( std::string XdsEnd2endTest::MakeConnectionFailureRegex( absl::string_view prefix) { - return absl::StrCat(prefix, - "(UNKNOWN|UNAVAILABLE): " - // IP address - "(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " - // Prefixes added for context - "(Failed to connect to remote host: )?" - "(Timeout occurred: )?" - // Syscall - "((connect|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?" - // strerror() output or other message - "(Connection refused" - "|Connection reset by peer" - "|Socket closed" - "|FD shutdown)" - // errno value - "( \\([0-9]+\\))?"); + return absl::StrCat( + prefix, + "(UNKNOWN|UNAVAILABLE): " + // IP address + "(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " + // Prefixes added for context + "(Failed to connect to remote host: )?" + "(Timeout occurred: )?" + // Syscall + "((connect|sendmsg|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?" + // strerror() output or other message + "(Connection refused" + "|Connection reset by peer" + "|Socket closed" + "|FD shutdown)" + // errno value + "( \\([0-9]+\\))?"); } grpc_core::PemKeyCertPairList XdsEnd2endTest::ReadTlsIdentityPair(