aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-11-09 14:40:22 -0800
committerGravatar Mark D. Roth <roth@google.com>2016-11-09 14:40:22 -0800
commit4bbdda4444d740c50774218427a319931e402fe2 (patch)
tree15abfda668363f0bd00b674413a794969fd60099 /test
parentc625c7a023cb688a135be96cef64543f0e08a851 (diff)
Allow getting LB policy name and service config in C++ API.
Diffstat (limited to 'test')
-rw-r--r--test/cpp/end2end/round_robin_end2end_test.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc
index 76211cbdd3..cc340b96b3 100644
--- a/test/cpp/end2end/round_robin_end2end_test.cc
+++ b/test/cpp/end2end/round_robin_end2end_test.cc
@@ -109,9 +109,9 @@ class RoundRobinEnd2endTest : public ::testing::Test {
uri << "127.0.0.1:" << servers_[i]->port_ << ",";
}
uri << "127.0.0.1:" << servers_[servers_.size() - 1]->port_;
- std::shared_ptr<Channel> channel =
+ channel_ =
CreateCustomChannel(uri.str(), InsecureChannelCredentials(), args);
- stub_ = grpc::testing::EchoTestService::NewStub(channel);
+ stub_ = grpc::testing::EchoTestService::NewStub(channel_);
}
void SendRpc(int num_rpcs) {
@@ -165,6 +165,7 @@ class RoundRobinEnd2endTest : public ::testing::Test {
const grpc::string server_host_;
CompletionQueue cli_cq_;
+ std::shared_ptr<Channel> channel_;
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::vector<std::unique_ptr<ServerData>> servers_;
};
@@ -186,6 +187,8 @@ TEST_F(RoundRobinEnd2endTest, PickFirst) {
}
}
EXPECT_TRUE(found);
+ // Check LB policy name for the channel.
+ EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName());
}
TEST_F(RoundRobinEnd2endTest, RoundRobin) {
@@ -198,6 +201,8 @@ TEST_F(RoundRobinEnd2endTest, RoundRobin) {
for (size_t i = 0; i < servers_.size(); ++i) {
EXPECT_EQ(1, servers_[i]->service_.request_count());
}
+ // Check LB policy name for the channel.
+ EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName());
}
} // namespace