[client_lb_e2e_test] fix flake in RR HealthChecking test (#34572)

pull/34576/head
Mark D. Roth 1 year ago committed by GitHub
parent 445856978f
commit 883ec58237
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 29
      test/cpp/end2end/client_lb_end2end_test.cc

@ -1945,6 +1945,9 @@ TEST_F(RoundRobinTest, HealthChecking) {
gpr_log(GPR_INFO, "*** server 0 healthy"); gpr_log(GPR_INFO, "*** server 0 healthy");
servers_[0]->SetServingStatus("health_check_service_name", true); servers_[0]->SetServingStatus("health_check_service_name", true);
EXPECT_TRUE(WaitForChannelReady(channel.get())); EXPECT_TRUE(WaitForChannelReady(channel.get()));
// New channel state may be reported before the picker is updated, so
// wait for the server before proceeding.
WaitForServer(DEBUG_LOCATION, stub, 0);
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
CheckRpcSendOk(DEBUG_LOCATION, stub); CheckRpcSendOk(DEBUG_LOCATION, stub);
} }
@ -1990,15 +1993,23 @@ TEST_F(RoundRobinTest, HealthChecking) {
servers_[1]->SetServingStatus("health_check_service_name", false); servers_[1]->SetServingStatus("health_check_service_name", false);
servers_[2]->SetServingStatus("health_check_service_name", false); servers_[2]->SetServingStatus("health_check_service_name", false);
EXPECT_TRUE(WaitForChannelNotReady(channel.get())); EXPECT_TRUE(WaitForChannelNotReady(channel.get()));
CheckRpcSendFailure( // New channel state may be reported before the picker is updated, so
DEBUG_LOCATION, stub, StatusCode::UNAVAILABLE, // one or two more RPCs may succeed before we see a failure.
grpc_core::IsRoundRobinDelegateToPickFirstEnabled() SendRpcsUntil(DEBUG_LOCATION, stub, [&](const Status& status) {
? "connections to all backends failing; last error: " if (status.ok()) return true;
"(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " EXPECT_EQ(status.error_code(), StatusCode::UNAVAILABLE);
"backend unhealthy" EXPECT_THAT(
: "connections to all backends failing; last error: " status.error_message(),
"UNAVAILABLE: (ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: " ::testing::MatchesRegex(
"backend unhealthy"); grpc_core::IsRoundRobinDelegateToPickFirstEnabled()
? "connections to all backends failing; last error: "
"(ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: "
"backend unhealthy"
: "connections to all backends failing; last error: "
"UNAVAILABLE: (ipv6:%5B::1%5D|ipv4:127.0.0.1):[0-9]+: "
"backend unhealthy"));
return false;
});
// Clean up. // Clean up.
EnableDefaultHealthCheckService(false); EnableDefaultHealthCheckService(false);
} }

Loading…
Cancel
Save