From c495d2aa1f8d4222910cdf8e29c7ac50db6ebf94 Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Wed, 29 May 2024 09:33:20 -0700 Subject: [PATCH] [CSM] Stop using xDS enabled server for CSM observability tests (#36725) Closes #36725 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36725 from yashykt:RemoveXdsEnabledServerFromCsmInterop 91f3120f078068979274881bc02b7cd5905c61e5 PiperOrigin-RevId: 638313782 --- test/cpp/interop/xds_interop_server.cc | 7 +++---- test/cpp/interop/xds_interop_server_lib.cc | 16 ++++++---------- test/cpp/interop/xds_interop_server_lib.h | 5 ++--- test/cpp/interop/xds_interop_server_test.cc | 5 ++--- 4 files changed, 13 insertions(+), 20 deletions(-) diff --git a/test/cpp/interop/xds_interop_server.cc b/test/cpp/interop/xds_interop_server.cc index ecb951e64c0..09553cb82b6 100644 --- a/test/cpp/interop/xds_interop_server.cc +++ b/test/cpp/interop/xds_interop_server.cc @@ -86,10 +86,9 @@ int main(int argc, char** argv) { if (enable_csm_observability) { observability = EnableCsmObservability(); } - grpc::testing::RunServer(absl::GetFlag(FLAGS_secure_mode), - enable_csm_observability, port, maintenance_port, - hostname, absl::GetFlag(FLAGS_server_id), - [](grpc::Server* /* unused */) {}); + grpc::testing::RunServer( + absl::GetFlag(FLAGS_secure_mode), port, maintenance_port, hostname, + absl::GetFlag(FLAGS_server_id), [](grpc::Server* /* unused */) {}); return 0; } diff --git a/test/cpp/interop/xds_interop_server_lib.cc b/test/cpp/interop/xds_interop_server_lib.cc index d1ee23381af..6a4202ff9fa 100644 --- a/test/cpp/interop/xds_interop_server_lib.cc +++ b/test/cpp/interop/xds_interop_server_lib.cc @@ -226,9 +226,8 @@ absl::optional GetStatusForRpcBehaviorMetadata( return absl::nullopt; } -void RunServer(bool secure_mode, bool enable_csm_observability, int port, - const int maintenance_port, absl::string_view hostname, - absl::string_view server_id, +void RunServer(bool secure_mode, int port, const int maintenance_port, + absl::string_view hostname, absl::string_view server_id, const std::function& server_callback) { std::unique_ptr xds_enabled_server; std::unique_ptr server; @@ -252,14 +251,11 @@ void RunServer(bool secure_mode, bool enable_csm_observability, int port, .BuildAndStart(); LOG(INFO) << "Maintenance server listening on 0.0.0.0:" << maintenance_port; } else { - // CSM Observability requires an xDS enabled server. - auto builder = enable_csm_observability - ? std::make_unique() - : std::make_unique(); - maintenance_services.AddToServerBuilder(builder.get()); + ServerBuilder builder; + maintenance_services.AddToServerBuilder(&builder); server = builder - ->AddListeningPort(absl::StrCat("0.0.0.0:", port), - grpc::InsecureServerCredentials()) + .AddListeningPort(absl::StrCat("0.0.0.0:", port), + grpc::InsecureServerCredentials()) .RegisterService(&service) .BuildAndStart(); LOG(INFO) << "Server listening on 0.0.0.0:" << port; diff --git a/test/cpp/interop/xds_interop_server_lib.h b/test/cpp/interop/xds_interop_server_lib.h index 4b196d02fa9..01e0b6185b9 100644 --- a/test/cpp/interop/xds_interop_server_lib.h +++ b/test/cpp/interop/xds_interop_server_lib.h @@ -30,9 +30,8 @@ namespace testing { absl::optional GetStatusForRpcBehaviorMetadata( absl::string_view header_value, absl::string_view hostname); -void RunServer(bool secure_mode, bool enable_csm_observability, int port, - const int maintenance_port, absl::string_view hostname, - absl::string_view server_id, +void RunServer(bool secure_mode, int port, const int maintenance_port, + absl::string_view hostname, absl::string_view server_id, const std::function& server_callback); } // namespace testing diff --git a/test/cpp/interop/xds_interop_server_test.cc b/test/cpp/interop/xds_interop_server_test.cc index 50f8196b202..479bf9125c3 100644 --- a/test/cpp/interop/xds_interop_server_test.cc +++ b/test/cpp/interop/xds_interop_server_test.cc @@ -37,9 +37,8 @@ namespace { void ServerLoop(int port, grpc_core::Mutex* mutex, grpc_core::CondVar* condition, Server** server) { - RunServer(false, /*enable_csm_observability=*/false, port, - /* should not be used */ -1, "127.0.0.1", "test_server", - [&](Server* s) { + RunServer(false, port, /* should not be used */ -1, "127.0.0.1", + "test_server", [&](Server* s) { grpc_core::MutexLock lock(mutex); *server = s; condition->Signal();