Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Jul 3, 2024
1 parent 93fb176 commit 88fb9dd
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 53 deletions.
3 changes: 1 addition & 2 deletions test/core/test_util/test_lb_policies.cc
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,7 @@ class AuthorityOverrideLoadBalancingPolicy
absl::Status UpdateLocked(UpdateArgs args) override {
authority_override_ =
grpc_event_engine::experimental::Slice::FromCopiedString(
args.args
.GetString(GRPC_ARG_TEST_LB_AUTHORITY_OVERRIDE)
args.args.GetString(GRPC_ARG_TEST_LB_AUTHORITY_OVERRIDE)
.value_or(""));
return ForwardingLoadBalancingPolicy::UpdateLocked(std::move(args));
}
Expand Down
46 changes: 22 additions & 24 deletions test/cpp/end2end/client_lb_end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,8 @@ class ClientLbEnd2endTest : public ::testing::Test {
channel_creds =
std::make_shared<FakeTransportSecurityChannelCredentials>();
}
return grpc::CreateCustomChannel(
absl::StrCat("fake:", kDefaultAuthority), std::move(channel_creds),
args);
return grpc::CreateCustomChannel(absl::StrCat("fake:", kDefaultAuthority),
std::move(channel_creds), args);
}

Status SendRpc(
Expand Down Expand Up @@ -425,14 +424,13 @@ class ClientLbEnd2endTest : public ::testing::Test {
bool started_ ABSL_GUARDED_BY(mu_) = false;

explicit ServerData(
int port = 0,
std::shared_ptr<ServerCredentials> server_creds = nullptr)
int port = 0, std::shared_ptr<ServerCredentials> server_creds = nullptr)
: port_(port > 0 ? port : grpc_pick_unused_port_or_die()),
server_creds_(
server_creds == nullptr
? std::shared_ptr<ServerCredentials>(
new SecureServerCredentials(
grpc_fake_transport_security_server_credentials_create()))
? std::shared_ptr<
ServerCredentials>(new SecureServerCredentials(
grpc_fake_transport_security_server_credentials_create()))
: std::move(server_creds)),
server_metric_recorder_(experimental::ServerMetricRecorder::Create()),
orca_service_(
Expand All @@ -444,8 +442,8 @@ class ClientLbEnd2endTest : public ::testing::Test {
LOG(INFO) << "starting server on port " << port_;
grpc_core::MutexLock lock(&mu_);
started_ = true;
thread_ = std::make_unique<std::thread>(
std::bind(&ServerData::Serve, this));
thread_ =
std::make_unique<std::thread>(std::bind(&ServerData::Serve, this));
while (!server_ready_) {
cond_.Wait(&mu_);
}
Expand Down Expand Up @@ -761,8 +759,8 @@ TEST_F(AuthorityOverrideTest, OverrideFromLbPolicy) {
FakeResolverResponseGeneratorWrapper response_generator;
ChannelArguments args;
args.SetString(GRPC_ARG_TEST_LB_AUTHORITY_OVERRIDE, "from-lb.example.com");
auto channel = BuildChannel("authority_override_lb", response_generator,
args, InsecureChannelCredentials());
auto channel = BuildChannel("authority_override_lb", response_generator, args,
InsecureChannelCredentials());
auto stub = BuildStub(channel);
response_generator.SetNextResolution(GetServersPorts());
// Send an RPC.
Expand Down Expand Up @@ -835,8 +833,8 @@ TEST_F(AuthorityOverrideTest,
ChannelArguments args;
args.SetString(GRPC_ARG_DEFAULT_AUTHORITY, "from-channel.example.com");
args.SetString(GRPC_ARG_TEST_LB_AUTHORITY_OVERRIDE, "from-lb.example.com");
auto channel = BuildChannel("authority_override_lb", response_generator,
args, InsecureChannelCredentials());
auto channel = BuildChannel("authority_override_lb", response_generator, args,
InsecureChannelCredentials());
auto stub = BuildStub(channel);
response_generator.SetNextResolution(GetServersPorts());
// Send an RPC.
Expand All @@ -859,8 +857,8 @@ TEST_F(AuthorityOverrideTest,
FakeResolverResponseGeneratorWrapper response_generator;
ChannelArguments args;
args.SetString(GRPC_ARG_TEST_LB_AUTHORITY_OVERRIDE, "from-lb.example.com");
auto channel = BuildChannel("authority_override_lb", response_generator,
args, InsecureChannelCredentials());
auto channel = BuildChannel("authority_override_lb", response_generator, args,
InsecureChannelCredentials());
auto stub = BuildStub(channel);
response_generator.SetNextResolution(GetServersPorts());
// Send an RPC.
Expand Down Expand Up @@ -2146,16 +2144,16 @@ TEST_F(RoundRobinTest, WithHealthCheckingInhibitPerChannel) {
"{\"healthCheckConfig\": "
"{\"serviceName\": \"health_check_service_name\"}}");
FakeResolverResponseGeneratorWrapper response_generator1;
auto channel1 = BuildChannel("round_robin", response_generator1, args,
channel_creds);
auto channel1 =
BuildChannel("round_robin", response_generator1, args, channel_creds);
auto stub1 = BuildStub(channel1);
std::vector<int> ports = GetServersPorts();
response_generator1.SetNextResolution(ports);
// Create a channel with health checking enabled but inhibited.
args.SetInt(GRPC_ARG_INHIBIT_HEALTH_CHECKING, 1);
FakeResolverResponseGeneratorWrapper response_generator2;
auto channel2 = BuildChannel("round_robin", response_generator2, args,
channel_creds);
auto channel2 =
BuildChannel("round_robin", response_generator2, args, channel_creds);
auto stub2 = BuildStub(channel2);
response_generator2.SetNextResolution(ports);
// First channel should not become READY, because health checks should be
Expand Down Expand Up @@ -2192,8 +2190,8 @@ TEST_F(RoundRobinTest, HealthCheckingServiceNamePerChannel) {
"{\"healthCheckConfig\": "
"{\"serviceName\": \"health_check_service_name\"}}");
FakeResolverResponseGeneratorWrapper response_generator1;
auto channel1 = BuildChannel("round_robin", response_generator1, args,
channel_creds);
auto channel1 =
BuildChannel("round_robin", response_generator1, args, channel_creds);
auto stub1 = BuildStub(channel1);
std::vector<int> ports = GetServersPorts();
response_generator1.SetNextResolution(ports);
Expand All @@ -2204,8 +2202,8 @@ TEST_F(RoundRobinTest, HealthCheckingServiceNamePerChannel) {
"{\"healthCheckConfig\": "
"{\"serviceName\": \"health_check_service_name2\"}}");
FakeResolverResponseGeneratorWrapper response_generator2;
auto channel2 = BuildChannel("round_robin", response_generator2, args2,
channel_creds);
auto channel2 =
BuildChannel("round_robin", response_generator2, args2, channel_creds);
auto stub2 = BuildStub(channel2);
response_generator2.SetNextResolution(ports);
// Allow health checks from channel 2 to succeed.
Expand Down
51 changes: 26 additions & 25 deletions test/cpp/end2end/xds/xds_cluster_end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1186,16 +1186,17 @@ TEST_P(EdsAuthorityRewriteTest, AutoAuthorityRewrite) {
SetRouteConfiguration(balancer_.get(), new_route_config);
// Create 3 backends. Backend 0 does not have a hostname, but 1 and 2 do.
CreateAndStartBackends(3, /*enable_xds=*/false, InsecureServerCredentials());
EdsResourceArgs args({
{"locality0",
{CreateEndpoint(0),
CreateEndpoint(1, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority1),
CreateEndpoint(2, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority2),
}}});
EdsResourceArgs args(
{{"locality0",
{
CreateEndpoint(0),
CreateEndpoint(1, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority1),
CreateEndpoint(2, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority2),
}}});
balancer_->ads_service()->SetEdsResource(BuildEdsResource(args));
WaitForAllBackends(DEBUG_LOCATION);
// Send one RPC for each backend, check the authority headers seen on
Expand Down Expand Up @@ -1227,11 +1228,11 @@ TEST_P(EdsAuthorityRewriteTest, NoRewriteWithoutEnvVar) {
SetRouteConfiguration(balancer_.get(), new_route_config);
// Create a backend with a hostname in EDS.
CreateAndStartBackends(1);
EdsResourceArgs args({
{"locality0",
{CreateEndpoint(0, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority)}}});
EdsResourceArgs args(
{{"locality0",
{CreateEndpoint(0, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority)}}});
balancer_->ads_service()->SetEdsResource(BuildEdsResource(args));
// Send an RPC and check the authority seen on the server side.
EchoResponse response;
Expand All @@ -1257,11 +1258,11 @@ TEST_P(EdsAuthorityRewriteTest, NoRewriteIfServerNotTrustedInBootstrap) {
SetRouteConfiguration(balancer_.get(), new_route_config);
// Create a backend with a hostname in EDS.
CreateAndStartBackends(1);
EdsResourceArgs args({
{"locality0",
{CreateEndpoint(0, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority)}}});
EdsResourceArgs args(
{{"locality0",
{CreateEndpoint(0, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority)}}});
balancer_->ads_service()->SetEdsResource(BuildEdsResource(args));
// Send an RPC and check the authority seen on the server side.
EchoResponse response;
Expand Down Expand Up @@ -1304,11 +1305,11 @@ TEST_P(EdsAuthorityRewriteTest, NoRewriteIfNotEnabledInRoute) {
InitClient(MakeBootstrapBuilder().SetTrustedXdsServer());
// Create a backend with a hostname in EDS.
CreateAndStartBackends(1);
EdsResourceArgs args({
{"locality0",
{CreateEndpoint(0, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority)}}});
EdsResourceArgs args(
{{"locality0",
{CreateEndpoint(0, ::envoy::config::core::v3::HealthStatus::UNKNOWN,
/*lb_weight=*/1, /*additional_backend_indxes=*/{},
/*hostname=*/kAltAuthority)}}});
balancer_->ads_service()->SetEdsResource(BuildEdsResource(args));
// Send an RPC and check the authority seen on the server side.
EchoResponse response;
Expand Down
4 changes: 2 additions & 2 deletions test/cpp/end2end/xds/xds_end2end_test_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ class XdsEnd2endTest : public ::testing::TestWithParam<XdsTestType>,
additional_ports.push_back(backends_[idx]->port());
}
return EdsResourceArgs::Endpoint(backends_[backend_idx]->port(),
health_status, lb_weight,
additional_ports, hostname);
health_status, lb_weight, additional_ports,
hostname);
}

// Creates a vector of endpoints for a specified range of backends,
Expand Down

0 comments on commit 88fb9dd

Please sign in to comment.