aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc6
-rw-r--r--test/cpp/end2end/client_lb_end2end_test.cc42
2 files changed, 20 insertions, 28 deletions
diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
index ab6d3e6a03..6d0485f395 100644
--- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
@@ -347,9 +347,9 @@ static void update_lb_connectivity_status_locked(grpc_lb_subchannel_data* sd,
} else if (subchannel_list->num_transient_failures ==
subchannel_list->num_subchannels) {
/* 3) TRANSIENT_FAILURE */
- grpc_connectivity_state_set(
- &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
- GRPC_ERROR_REF(error), "rr_exhausted_subchannels");
+ grpc_connectivity_state_set(&p->state_tracker,
+ GRPC_CHANNEL_TRANSIENT_FAILURE,
+ GRPC_ERROR_REF(error), "rr_transient_failure");
}
GRPC_ERROR_UNREF(error);
}
diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc
index 386d18e95d..f1816af3ce 100644
--- a/test/cpp/end2end/client_lb_end2end_test.cc
+++ b/test/cpp/end2end/client_lb_end2end_test.cc
@@ -139,8 +139,7 @@ class ClientLbEnd2endTest : public ::testing::Test {
}
}
- void SetNextResolution(const std::vector<int>& ports) {
- grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args* BuildFakeResults(const std::vector<int>& ports) {
grpc_lb_addresses* addresses =
grpc_lb_addresses_create(ports.size(), nullptr);
for (size_t i = 0; i < ports.size(); ++i) {
@@ -154,31 +153,26 @@ class ClientLbEnd2endTest : public ::testing::Test {
grpc_uri_destroy(lb_uri);
gpr_free(lb_uri_str);
}
- grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
- grpc_channel_args fake_result = {1, &fake_addresses};
- response_generator_->SetResponse(&fake_result);
+ const grpc_arg fake_addresses =
+ grpc_lb_addresses_create_channel_arg(addresses);
+ grpc_channel_args* fake_results =
+ grpc_channel_args_copy_and_add(nullptr, &fake_addresses, 1);
grpc_lb_addresses_destroy(addresses);
+ return fake_results;
+ }
+
+ void SetNextResolution(const std::vector<int>& ports) {
+ grpc_core::ExecCtx exec_ctx;
+ grpc_channel_args* fake_results = BuildFakeResults(ports);
+ response_generator_->SetResponse(fake_results);
+ grpc_channel_args_destroy(fake_results);
}
void SetNextResolutionUponError(const std::vector<int>& ports) {
grpc_core::ExecCtx exec_ctx;
- grpc_lb_addresses* addresses =
- grpc_lb_addresses_create(ports.size(), nullptr);
- for (size_t i = 0; i < ports.size(); ++i) {
- char* lb_uri_str;
- gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", ports[i]);
- grpc_uri* lb_uri = grpc_uri_parse(lb_uri_str, true);
- GPR_ASSERT(lb_uri != nullptr);
- grpc_lb_addresses_set_address_from_uri(addresses, i, lb_uri,
- false /* is balancer */,
- "" /* balancer name */, nullptr);
- grpc_uri_destroy(lb_uri);
- gpr_free(lb_uri_str);
- }
- grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
- grpc_channel_args fake_result = {1, &fake_addresses};
- response_generator_->SetReresolutionResponse(&fake_result);
- grpc_lb_addresses_destroy(addresses);
+ grpc_channel_args* fake_results = BuildFakeResults(ports);
+ response_generator_->SetReresolutionResponse(fake_results);
+ grpc_channel_args_destroy(fake_results);
}
std::vector<int> GetServersPorts() {
@@ -756,9 +750,7 @@ TEST_F(ClientLbEnd2endTest, RoundRobinSingleReconnect) {
// Client request still succeed. May need retrying if RR had returned a pick
// before noticing the change in the server's connectivity.
while (!SendRpc(stub)) {
- ; // Retry until success.
- }
- gpr_log(GPR_INFO, "------------------------------------------------------");
+ } // Retry until success.
// Send a bunch of RPCs that should succeed.
for (int i = 0; i < 10 * kNumServers; ++i) {
CheckRpcSendOk(stub, DEBUG_LOCATION);