aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2018-07-09 18:00:54 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2018-07-09 20:09:18 -0700
commitd1deaad1be9983e6c90d9022ae0b14fc7414baa2 (patch)
tree340b68b656d035b36cc77d38ef79ddf661e2e86b /test/cpp
parentc53f8dfbfcb92de66f6e70df7249337eb50dfdfb (diff)
Added test
Diffstat (limited to 'test/cpp')
-rw-r--r--test/cpp/end2end/client_lb_end2end_test.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc
index feea7c3907..6e06b2523a 100644
--- a/test/cpp/end2end/client_lb_end2end_test.cc
+++ b/test/cpp/end2end/client_lb_end2end_test.cc
@@ -539,6 +539,33 @@ TEST_F(ClientLbEnd2endTest, RoundRobin) {
EXPECT_EQ("round_robin", channel->GetLoadBalancingPolicyName());
}
+TEST_F(ClientLbEnd2endTest, RoundRobinProcessPending) {
+ StartServers(1); // Single server
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
+ SetNextResolution({servers_[0]->port_});
+ WaitForServer(stub, 0, DEBUG_LOCATION);
+ constexpr int kIterations = 4;
+ constexpr int kNumThreads = 4;
+ std::vector<std::thread> threads;
+ // Create and destroy several channels concurrently, executing an RPC each
+ // time. This will force the recycling of the underlying (READY) subchannels.
+ // The RR LB policy of a newly created channel will pick these subchannels in
+ // READY state. Progress should happen without any transition from this READY
+ // state.
+ threads.push_back(std::thread([=]() {
+ for (int i = 0; i < kNumThreads; ++i) {
+ auto channel = BuildChannel("round_robin");
+ auto stub = BuildStub(channel);
+ SetNextResolution({servers_[0]->port_});
+ for (int i = 0; i < kIterations; ++i) {
+ CheckRpcSendOk(stub, DEBUG_LOCATION);
+ }
+ }
+ }));
+ for (auto& thread : threads) thread.join();
+}
+
TEST_F(ClientLbEnd2endTest, RoundRobinUpdates) {
// Start servers and send one RPC per server.
const int kNumServers = 3;