[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 91f3120f07
PiperOrigin-RevId: 638313782
pull/36731/head^2
Yash Tibrewal 6 months ago committed by Copybara-Service
parent a88ee9ef99
commit c495d2aa1f
  1. 7
      test/cpp/interop/xds_interop_server.cc
  2. 16
      test/cpp/interop/xds_interop_server_lib.cc
  3. 5
      test/cpp/interop/xds_interop_server_lib.h
  4. 5
      test/cpp/interop/xds_interop_server_test.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;
}

@ -226,9 +226,8 @@ absl::optional<grpc::Status> 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<void(Server*)>& server_callback) {
std::unique_ptr<Server> xds_enabled_server;
std::unique_ptr<Server> 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<XdsServerBuilder>()
: std::make_unique<ServerBuilder>();
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;

@ -30,9 +30,8 @@ namespace testing {
absl::optional<grpc::Status> 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<void(Server*)>& server_callback);
} // namespace testing

@ -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();

Loading…
Cancel
Save