Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Jan 2, 2025
1 parent a5e22f8 commit a78d4c6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 34 deletions.
6 changes: 3 additions & 3 deletions src/core/xds/grpc/xds_server_grpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ bool GrpcXdsServer::FailOnDataErrors() const {
}

bool GrpcXdsServer::ResourceTimerIsTransientFailure() const {
return server_features_.find(std::string(
kServerFeatureResourceTimerIsTransientFailure)) !=
server_features_.end();
return server_features_.find(
std::string(kServerFeatureResourceTimerIsTransientFailure)) !=
server_features_.end();
}

bool GrpcXdsServer::TrustedXdsServer() const {
Expand Down
28 changes: 14 additions & 14 deletions src/core/xds/xds_client/xds_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ class XdsClient::XdsChannel::AdsCall final
ads_call_ = std::move(ads_call);
Duration timeout = ads_call_->xds_client()->request_timeout_;
if (timeout == Duration::Zero()) {
timeout =
XdsDataErrorHandlingEnabled() &&
ads_call_->xds_channel()->server_.ResourceTimerIsTransientFailure()
? Duration::Seconds(30)
: Duration::Seconds(15);
timeout = XdsDataErrorHandlingEnabled() &&
ads_call_->xds_channel()
->server_.ResourceTimerIsTransientFailure()
? Duration::Seconds(30)
: Duration::Seconds(15);
}
timer_handle_ = ads_call_->xds_client()->engine()->RunAfter(
timeout, [self = Ref(DEBUG_LOCATION, "timer")]() {
Expand Down Expand Up @@ -244,8 +244,8 @@ class XdsClient::XdsChannel::AdsCall final
<< "} from xds server";
resource_seen_ = true;
if (XdsDataErrorHandlingEnabled() &&
ads_call_->xds_channel()->server_
.ResourceTimerIsTransientFailure()) {
ads_call_->xds_channel()
->server_.ResourceTimerIsTransientFailure()) {
state.SetTransientError(absl::StrCat(
"xDS server ", ads_call_->xds_channel()->server_uri(),
" not responding"));
Expand Down Expand Up @@ -1040,9 +1040,9 @@ void XdsClient::XdsChannel::AdsCall::ParseResource(
resource_state.WatcherStatus(), resource_state.watchers(),
context->read_delay_handle);
} else {
xds_client()->NotifyWatchersOnAmbientError(
resource_state.WatcherStatus(), resource_state.watchers(),
context->read_delay_handle);
xds_client()->NotifyWatchersOnAmbientError(resource_state.WatcherStatus(),
resource_state.watchers(),
context->read_delay_handle);
}
++context->num_invalid_resources;
return;
Expand Down Expand Up @@ -1606,10 +1606,10 @@ void XdsClient::WatchResource(const XdsResourceType* type,
absl::Status status = resource_state.WatcherStatus();
if (!status.ok()) {
GRPC_TRACE_LOG(xds_client, INFO)
<< "[xds_client " << this
<< "] reporting cached status for " << name << ": " << status;
NotifyWatchersOnResourceChanged(std::move(status),
{watcher}, ReadDelayHandle::NoWait());
<< "[xds_client " << this << "] reporting cached status for "
<< name << ": " << status;
NotifyWatchersOnResourceChanged(std::move(status), {watcher},
ReadDelayHandle::NoWait());
notified_watcher = true;
}
}
Expand Down
29 changes: 12 additions & 17 deletions test/core/xds/xds_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2877,9 +2877,8 @@ TEST_F(XdsClientTest, ResourceDoesNotExistUponTimeout) {
[&](grpc_event_engine::experimental::EventEngine::Duration duration) {
grpc_event_engine::experimental::EventEngine::Duration expected =
std::chrono::seconds(15);
EXPECT_EQ(duration, expected)
<< "Expected: " << expected.count()
<< "\nActual: " << duration.count();
EXPECT_EQ(duration, expected) << "Expected: " << expected.count()
<< "\nActual: " << duration.count();
});
InitXdsClient();
// Start a watch for "foo1".
Expand Down Expand Up @@ -2971,9 +2970,8 @@ TEST_F(XdsClientTest, ResourceTimerIsTransientErrorIgnoredUnlessEnabled) {
[&](grpc_event_engine::experimental::EventEngine::Duration duration) {
grpc_event_engine::experimental::EventEngine::Duration expected =
std::chrono::seconds(15);
EXPECT_EQ(duration, expected)
<< "Expected: " << expected.count()
<< "\nActual: " << duration.count();
EXPECT_EQ(duration, expected) << "Expected: " << expected.count()
<< "\nActual: " << duration.count();
});
InitXdsClient(FakeXdsBootstrap::Builder().SetServers(
{FakeXdsBootstrap::FakeXdsServer(kDefaultXdsServerUrl, false, true)}));
Expand Down Expand Up @@ -3068,9 +3066,8 @@ TEST_F(XdsClientTest, ResourceTimerIsTransientFailure) {
[&](grpc_event_engine::experimental::EventEngine::Duration duration) {
grpc_event_engine::experimental::EventEngine::Duration expected =
std::chrono::seconds(30);
EXPECT_EQ(duration, expected)
<< "Expected: " << expected.count()
<< "\nActual: " << duration.count();
EXPECT_EQ(duration, expected) << "Expected: " << expected.count()
<< "\nActual: " << duration.count();
});
InitXdsClient(FakeXdsBootstrap::Builder().SetServers(
{FakeXdsBootstrap::FakeXdsServer(kDefaultXdsServerUrl, false, true)}));
Expand Down Expand Up @@ -3104,10 +3101,9 @@ TEST_F(XdsClientTest, ResourceTimerIsTransientFailure) {
// not existing.
auto error = watcher->WaitForNextError();
ASSERT_TRUE(error.has_value());
EXPECT_EQ(error,
absl::UnavailableError(absl::StrCat(
"xDS server ", kDefaultXdsServerUrl,
" not responding (node ID:xds_client_test)")));
EXPECT_EQ(error, absl::UnavailableError(absl::StrCat(
"xDS server ", kDefaultXdsServerUrl,
" not responding (node ID:xds_client_test)")));
// Check metric data.
EXPECT_TRUE(metrics_reporter_->WaitForMetricsReporterData(
::testing::ElementsAre(), ::testing::ElementsAre(), ::testing::_));
Expand All @@ -3122,10 +3118,9 @@ TEST_F(XdsClientTest, ResourceTimerIsTransientFailure) {
auto watcher2 = StartFooWatch("foo1");
error = watcher2->WaitForNextError();
ASSERT_TRUE(error.has_value());
EXPECT_EQ(error,
absl::UnavailableError(absl::StrCat(
"xDS server ", kDefaultXdsServerUrl,
" not responding (node ID:xds_client_test)")));
EXPECT_EQ(error, absl::UnavailableError(absl::StrCat(
"xDS server ", kDefaultXdsServerUrl,
" not responding (node ID:xds_client_test)")));
// Now server sends a response.
stream->SendMessageToClient(
ResponseBuilder(XdsFooResourceType::Get()->type_url())
Expand Down

0 comments on commit a78d4c6

Please sign in to comment.