From d743b83b3b3dd71d06426caf474392aa6aed3b17 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Wed, 11 Sep 2024 17:04:24 +0000 Subject: [PATCH] [grpclb_e2e_test] fix flake in SwapChildPolicy test --- test/cpp/end2end/grpclb_end2end_test.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/cpp/end2end/grpclb_end2end_test.cc b/test/cpp/end2end/grpclb_end2end_test.cc index a640d8b499a67..01d9e3bc01c9a 100644 --- a/test/cpp/end2end/grpclb_end2end_test.cc +++ b/test/cpp/end2end/grpclb_end2end_test.cc @@ -985,18 +985,12 @@ TEST_F(GrpclbEnd2endTest, SwapChildPolicy) { // Check that all requests went to the first backend. This verifies // that we used pick_first instead of round_robin as the child policy. EXPECT_EQ(backends_[0]->service().request_count(), kNumRpcs); - for (size_t i = 1; i < backends_.size(); ++i) { - EXPECT_EQ(backends_[i]->service().request_count(), 0UL); - } + EXPECT_EQ(backends_[1]->service().request_count(), 0UL); // Send new resolution that removes child policy from service config. SetNextResolutionDefaultBalancer(); + // We should now be using round_robin, which will send traffic to all + // backends. WaitForAllBackends(); - CheckRpcSendOk(kNumRpcs, 3000 /* timeout_ms */, true /* wait_for_ready */); - // Check that every backend saw the same number of requests. This verifies - // that we used round_robin. - for (size_t i = 0; i < backends_.size(); ++i) { - EXPECT_EQ(backends_[i]->service().request_count(), 2UL); - } // The balancer got a single request. EXPECT_EQ(1U, balancer_->service().request_count()); // and sent a single response.