Skip to content

Commit

Permalink
Merge pull request #577 from markdroth/create-pull-request/patch-936ba30
Browse files Browse the repository at this point in the history
Automated fix for refs/heads/xds_watcher_api_change
  • Loading branch information
markdroth authored Dec 23, 2024
2 parents 936ba30 + 71b07d1 commit 07b5a9a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
5 changes: 2 additions & 3 deletions src/core/xds/xds_client/xds_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -855,9 +855,8 @@ void XdsClient::XdsChannel::AdsCall::AdsResponseParser::ParseResource(
// If we previously had connectivity problems, notify watchers that
// the ambient error has been cleared.
if (!ads_call_->xds_channel()->status().ok()) {
xds_client()->NotifyWatchersOnAmbientError(absl::OkStatus(),
resource_state.watchers,
result_.read_delay_handle);
xds_client()->NotifyWatchersOnAmbientError(
absl::OkStatus(), resource_state.watchers, result_.read_delay_handle);
}
return;
}
Expand Down
32 changes: 15 additions & 17 deletions test/core/xds/xds_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ class XdsClientTest : public ::testing::Test {
auto event = WaitForNextOnResourceChangedEvent(location);
if (!event.has_value()) return absl::nullopt;
EXPECT_TRUE(event->resource.ok())
<< "got unexpected error: " << event->resource.status()
<< " at " << location.file() << ":" << location.line();
<< "got unexpected error: " << event->resource.status() << " at "
<< location.file() << ":" << location.line();
if (!event->resource.ok()) return absl::nullopt;
return ResourceAndReadDelayHandle{
std::move(*event->resource), std::move(event->read_delay_handle)};
return ResourceAndReadDelayHandle{std::move(*event->resource),
std::move(event->read_delay_handle)};
}

std::shared_ptr<const ResourceStruct> WaitForNextResource(
Expand All @@ -296,8 +296,8 @@ class XdsClientTest : public ::testing::Test {
auto event = WaitForNextOnResourceChangedEvent(location);
if (!event.has_value()) return absl::nullopt;
EXPECT_FALSE(event->resource.ok())
<< "got unexpected resource: " << (*event->resource)->name
<< " at " << location.file() << ":" << location.line();
<< "got unexpected resource: " << (*event->resource)->name << " at "
<< location.file() << ":" << location.line();
if (event->resource.ok()) return absl::nullopt;
return event->resource.status();
}
Expand All @@ -320,8 +320,8 @@ class XdsClientTest : public ::testing::Test {
[&](const absl::StatusOr<std::shared_ptr<const ResourceStruct>>&
resource) -> absl::optional<absl::Status> {
EXPECT_TRUE(false)
<< "got unexpected resource: " << event->ToString()
<< " at " << location.file() << ":" << location.line();
<< "got unexpected resource: " << event->ToString() << " at "
<< location.file() << ":" << location.line();
return absl::nullopt;
},
[&](const absl::Status& status) -> absl::optional<absl::Status> {
Expand All @@ -347,17 +347,15 @@ class XdsClientTest : public ::testing::Test {
resource) {
return absl::StrCat(
"{resource=",
resource.ok()
? (*resource)->name
: resource.status().ToString(),
resource.ok() ? (*resource)->name
: resource.status().ToString(),
", read_delay_handle=", (read_delay_handle == nullptr),
"}");
},
[&](const absl::Status& status) {
return absl::StrCat(
"{ambient_error=", status.ToString(),
", read_delay_handle=", (read_delay_handle == nullptr),
"}");
return absl::StrCat("{ambient_error=", status.ToString(),
", read_delay_handle=",
(read_delay_handle == nullptr), "}");
});
}
};
Expand Down Expand Up @@ -387,8 +385,8 @@ class XdsClientTest : public ::testing::Test {
if (!event.has_value()) return absl::nullopt;
return MatchMutable(
&event->payload,
[&](absl::StatusOr<std::shared_ptr<const ResourceStruct>>*
resource) -> absl::optional<OnResourceChangedEvent> {
[&](absl::StatusOr<std::shared_ptr<const ResourceStruct>>* resource)
-> absl::optional<OnResourceChangedEvent> {
return OnResourceChangedEvent{
std::move(*resource), std::move(event->read_delay_handle)};
},
Expand Down

0 comments on commit 07b5a9a

Please sign in to comment.