From 416843075521d6a5e1fe1148f6783434fd47e980 Mon Sep 17 00:00:00 2001 From: Adi Suissa-Peleg Date: Wed, 23 Oct 2024 18:29:09 +0000 Subject: [PATCH] test cleanup to avoid tsan Signed-off-by: Adi Suissa-Peleg --- test/integration/ads_integration_test.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/integration/ads_integration_test.cc b/test/integration/ads_integration_test.cc index 00a3fb1657e5..c4ed45120476 100644 --- a/test/integration/ads_integration_test.cc +++ b/test/integration/ads_integration_test.cc @@ -2838,6 +2838,22 @@ class AdsReplacementIntegrationTest : public AdsIntegrationTest { } } + void cleanUpSecondXdsConnection() { + // Cleanup the second xds connection if used. + if (second_xds_connection_ != nullptr) { + AssertionResult result = second_xds_connection_->close(); + RELEASE_ASSERT(result, result.message()); + result = second_xds_connection_->waitForDisconnect(); + RELEASE_ASSERT(result, result.message()); + second_xds_connection_.reset(); + } + } + + void TearDown() override { + cleanUpSecondXdsConnection(); + AdsIntegrationTest::TearDown(); + } + // Second ADS stream. FakeUpstream* second_xds_upstream_{}; FakeHttpConnectionPtr second_xds_connection_;