[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 043e5fdadb
PiperOrigin-RevId: 644540986
pull/35773/head
Mark D. Roth 5 months ago committed by Copybara-Service
parent 8dac453a71
commit 22322fe7df
  1. 33
      test/cpp/end2end/client_lb_end2end_test.cc
  2. 33
      test/cpp/end2end/xds/xds_end2end_test_lib.cc

@ -580,22 +580,23 @@ class ClientLbEnd2endTest : public ::testing::Test {
} }
static std::string MakeConnectionFailureRegex(absl::string_view prefix) { static std::string MakeConnectionFailureRegex(absl::string_view prefix) {
return absl::StrCat(prefix, return absl::StrCat(
"; last error: (UNKNOWN|UNAVAILABLE): " prefix,
// IP address "; last error: (UNKNOWN|UNAVAILABLE): "
"(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " // IP address
// Prefixes added for context "(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: "
"(Failed to connect to remote host: )?" // Prefixes added for context
"(Timeout occurred: )?" "(Failed to connect to remote host: )?"
// Syscall "(Timeout occurred: )?"
"((connect|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?" // Syscall
// strerror() output or other message "((connect|sendmsg|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?"
"(Connection refused" // strerror() output or other message
"|Connection reset by peer" "(Connection refused"
"|Socket closed" "|Connection reset by peer"
"|FD shutdown)" "|Socket closed"
// errno value "|FD shutdown)"
"( \\([0-9]+\\))?"); // errno value
"( \\([0-9]+\\))?");
} }
const std::string server_host_; const std::string server_host_;

@ -836,22 +836,23 @@ void XdsEnd2endTest::SetProtoDuration(
std::string XdsEnd2endTest::MakeConnectionFailureRegex( std::string XdsEnd2endTest::MakeConnectionFailureRegex(
absl::string_view prefix) { absl::string_view prefix) {
return absl::StrCat(prefix, return absl::StrCat(
"(UNKNOWN|UNAVAILABLE): " prefix,
// IP address "(UNKNOWN|UNAVAILABLE): "
"(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " // IP address
// Prefixes added for context "(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: "
"(Failed to connect to remote host: )?" // Prefixes added for context
"(Timeout occurred: )?" "(Failed to connect to remote host: )?"
// Syscall "(Timeout occurred: )?"
"((connect|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?" // Syscall
// strerror() output or other message "((connect|sendmsg|recvmsg|getsockopt\\(SO\\_ERROR\\)): ?)?"
"(Connection refused" // strerror() output or other message
"|Connection reset by peer" "(Connection refused"
"|Socket closed" "|Connection reset by peer"
"|FD shutdown)" "|Socket closed"
// errno value "|FD shutdown)"
"( \\([0-9]+\\))?"); // errno value
"( \\([0-9]+\\))?");
} }
grpc_core::PemKeyCertPairList XdsEnd2endTest::ReadTlsIdentityPair( grpc_core::PemKeyCertPairList XdsEnd2endTest::ReadTlsIdentityPair(

Loading…
Cancel
Save