Skip to content

Commit

Permalink
[grpclb_e2e_test] fix flake in SwapChildPolicy test
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Sep 11, 2024
1 parent 0aca67e commit d743b83
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions test/cpp/end2end/grpclb_end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d743b83

Please sign in to comment.