aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/client
diff options
context:
space:
mode:
authorGravatar hcaseyal <hcaseyal@gmail.com>2018-12-07 16:13:37 -0800
committerGravatar GitHub <noreply@github.com>2018-12-07 16:13:37 -0800
commit27e2ba31bffa1c27fe12ad7d55e70b450eb777a8 (patch)
tree55b94f815d4213e0a82ebeb3766758d6793afb0b /test/cpp/client
parentbc91ebf74c5e7f1cca4de5b6b906344194ba6c4a (diff)
Revert "Allow encoding arbitrary channel args on a per-address basis."
Diffstat (limited to 'test/cpp/client')
-rw-r--r--test/cpp/client/client_channel_stress_test.cc28
1 files changed, 9 insertions, 19 deletions
diff --git a/test/cpp/client/client_channel_stress_test.cc b/test/cpp/client/client_channel_stress_test.cc
index 124557eb56..bf321d8a89 100644
--- a/test/cpp/client/client_channel_stress_test.cc
+++ b/test/cpp/client/client_channel_stress_test.cc
@@ -34,9 +34,7 @@
#include <grpcpp/server.h>
#include <grpcpp/server_builder.h>
-#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
-#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/sockaddr.h"
@@ -218,31 +216,23 @@ class ClientChannelStressTest {
void SetNextResolution(const std::vector<AddressData>& address_data) {
grpc_core::ExecCtx exec_ctx;
- grpc_core::ServerAddressList addresses;
- for (const auto& addr : address_data) {
+ grpc_lb_addresses* addresses =
+ grpc_lb_addresses_create(address_data.size(), nullptr);
+ for (size_t i = 0; i < address_data.size(); ++i) {
char* lb_uri_str;
- gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", addr.port);
+ gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", address_data[i].port);
grpc_uri* lb_uri = grpc_uri_parse(lb_uri_str, true);
GPR_ASSERT(lb_uri != nullptr);
- grpc_resolved_address address;
- GPR_ASSERT(grpc_parse_uri(lb_uri, &address));
- std::vector<grpc_arg> args_to_add;
- if (addr.is_balancer) {
- args_to_add.emplace_back(grpc_channel_arg_integer_create(
- const_cast<char*>(GRPC_ARG_ADDRESS_IS_BALANCER), 1));
- args_to_add.emplace_back(grpc_channel_arg_string_create(
- const_cast<char*>(GRPC_ARG_ADDRESS_BALANCER_NAME),
- const_cast<char*>(addr.balancer_name.c_str())));
- }
- grpc_channel_args* args = grpc_channel_args_copy_and_add(
- nullptr, args_to_add.data(), args_to_add.size());
- addresses.emplace_back(address.addr, address.len, args);
+ grpc_lb_addresses_set_address_from_uri(
+ addresses, i, lb_uri, address_data[i].is_balancer,
+ address_data[i].balancer_name.c_str(), nullptr);
grpc_uri_destroy(lb_uri);
gpr_free(lb_uri_str);
}
- grpc_arg fake_addresses = CreateServerAddressListChannelArg(&addresses);
+ grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses);
grpc_channel_args fake_result = {1, &fake_addresses};
response_generator_->SetResponse(&fake_result);
+ grpc_lb_addresses_destroy(addresses);
}
void KeepSendingRequests() {