xds_client_test: fix flake (#30980)

pull/30986/head
Mark D. Roth 2 years ago committed by GitHub
parent e5aadf985e
commit 61ee1656d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      test/core/xds/xds_client_test.cc

@ -1975,12 +1975,14 @@ TEST_F(XdsClientTest, Federation) {
/*resource_names=*/{kXdstpResourceName});
// Cancel watch for "foo1".
CancelFooWatch(watcher.get(), "foo1");
// XdsClient should send an unsubscription request.
// The XdsClient may or may not send the unsubscription message
// before it closes the transport, depending on callback timing.
request = WaitForRequest(stream.get());
ASSERT_TRUE(request.has_value());
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
/*version_info=*/"1", /*response_nonce=*/"A",
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{});
if (request.has_value()) {
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
/*version_info=*/"1", /*response_nonce=*/"A",
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{});
}
// Now cancel watch for xdstp resource name.
CancelFooWatch(watcher2.get(), kXdstpResourceName);
// The XdsClient may or may not send the unsubscription message
@ -2271,12 +2273,14 @@ TEST_F(XdsClientTest, FederationChannelFailureReportedToWatchers) {
EXPECT_FALSE(watcher->HasEvent());
// Cancel watch for "foo1".
CancelFooWatch(watcher.get(), "foo1");
// XdsClient should send an unsubscription request.
// The XdsClient may or may not send the unsubscription message
// before it closes the transport, depending on callback timing.
request = WaitForRequest(stream.get());
ASSERT_TRUE(request.has_value());
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
/*version_info=*/"1", /*response_nonce=*/"A",
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{});
if (request.has_value()) {
CheckRequest(*request, XdsFooResourceType::Get()->type_url(),
/*version_info=*/"1", /*response_nonce=*/"A",
/*error_detail=*/absl::OkStatus(), /*resource_names=*/{});
}
// Now cancel watch for xdstp resource name.
CancelFooWatch(watcher2.get(), kXdstpResourceName);
// The XdsClient may or may not send the unsubscription message

Loading…
Cancel
Save