From 78c799bce651e740bb051ac26b16d714995731d4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 1 Mar 2023 23:11:07 -0800 Subject: [PATCH] Revert "GCP Observability testing for C++" (#32518) Reverts grpc/grpc#32466 --- test/cpp/interop/BUILD | 63 ---------------- test/cpp/interop/observability_client.cc | 74 ------------------- .../observability_interop_server_bootstrap.cc | 55 -------------- .../extract_metadata_from_bazel_xml.py | 3 +- .../observability-test/cpp/Dockerfile | 57 -------------- .../observability-test/cpp/build_docker.sh | 26 ------- .../dockerfile/observability-test/cpp/run.sh | 43 ----------- 7 files changed, 1 insertion(+), 320 deletions(-) delete mode 100644 test/cpp/interop/observability_client.cc delete mode 100644 test/cpp/interop/observability_interop_server_bootstrap.cc delete mode 100644 tools/dockerfile/observability-test/cpp/Dockerfile delete mode 100755 tools/dockerfile/observability-test/cpp/build_docker.sh delete mode 100755 tools/dockerfile/observability-test/cpp/run.sh diff --git a/test/cpp/interop/BUILD b/test/cpp/interop/BUILD index dc19c69fd7a..1d55b9fcc9f 100644 --- a/test/cpp/interop/BUILD +++ b/test/cpp/interop/BUILD @@ -356,66 +356,3 @@ grpc_cc_binary( "//test/cpp/util:test_config", ], ) - -grpc_cc_binary( - name = "observability_interop_server", - srcs = [ - "observability_interop_server_bootstrap.cc", - ], - external_deps = [ - "absl/flags:flag", - ], - language = "C++", - deps = [ - ":interop_server_lib", - "//:grpc++", - "//:grpcpp_gcp_observability", - "//test/cpp/util:test_util", - ], -) - -grpc_cc_library( - name = "observability_interop_client_main", - srcs = [ - "observability_client.cc", - ], - external_deps = [ - "absl/flags:flag", - ], - language = "C++", - deps = [ - ":client_helper_lib", - "//:grpcpp_gcp_observability", - ], -) - -grpc_cc_binary( - name = "observability_interop_client", - language = "C++", - deps = [ - ":observability_interop_client_main", - "//:grpc++", - "//test/cpp/util:test_util", - ], -) - -grpc_cc_binary( - name = "observability_interop_test", - srcs = ["interop_test.cc"], - data = [ - ":observability_interop_client", - ":observability_interop_server", - ], - external_deps = [ - "absl/flags:flag", - ], - tags = ["no_windows"], - deps = [ - "//:gpr", - "//:grpc", - "//:grpc++", - "//test/core/util:grpc_test_util", - "//test/cpp/util:test_config", - "//test/cpp/util:test_util", - ], -) diff --git a/test/cpp/interop/observability_client.cc b/test/cpp/interop/observability_client.cc deleted file mode 100644 index 7c6e0cfa844..00000000000 --- a/test/cpp/interop/observability_client.cc +++ /dev/null @@ -1,74 +0,0 @@ -// -// -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// - -#include -#include - -#include "absl/flags/flag.h" - -#include -#include -#include -#include -#include -#include - -#include "src/core/lib/gpr/string.h" -#include "src/core/lib/gprpp/crash.h" -#include "test/core/util/test_config.h" -#include "test/cpp/interop/client_helper.h" -#include "test/cpp/interop/interop_client.h" -#include "test/cpp/util/test_config.h" - -ABSL_FLAG(bool, enable_observability, false, - "Whether to enable GCP Observability"); - -using grpc::testing::RunClient; - -int main(int argc, char** argv) { - grpc::testing::TestEnvironment env(&argc, argv); - grpc::testing::InitTest(&argc, &argv, true); - gpr_log(GPR_INFO, "Testing these cases: %s", - absl::GetFlag(FLAGS_test_case).c_str()); - - if (absl::GetFlag(FLAGS_enable_observability)) { - auto status = grpc::experimental::GcpObservabilityInit(); - gpr_log(GPR_DEBUG, "GcpObservabilityInit() status_code: %d", status.code()); - if (!status.ok()) { - return 1; - } - } - - int ret = RunClient(); - - if (absl::GetFlag(FLAGS_enable_observability)) { - grpc::experimental::GcpObservabilityClose(); - // TODO(stanleycheung): remove this once the observability exporter plugin - // is able to gracefully flush observability data to - // cloud at shutdown - const int observability_exporter_sleep_seconds = 65; - gpr_log(GPR_DEBUG, "Sleeping %ds before shutdown.", - observability_exporter_sleep_seconds); - gpr_sleep_until( - gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), - gpr_time_from_seconds(observability_exporter_sleep_seconds, - GPR_TIMESPAN))); - } - - return ret; -} diff --git a/test/cpp/interop/observability_interop_server_bootstrap.cc b/test/cpp/interop/observability_interop_server_bootstrap.cc deleted file mode 100644 index bb982cf1f4a..00000000000 --- a/test/cpp/interop/observability_interop_server_bootstrap.cc +++ /dev/null @@ -1,55 +0,0 @@ -// -// -// Copyright 2016 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// - -#include - -#include "absl/flags/flag.h" - -#include - -#include "test/core/util/test_config.h" -#include "test/cpp/interop/server_helper.h" -#include "test/cpp/util/test_config.h" - -gpr_atm grpc::testing::interop::g_got_sigint; - -ABSL_FLAG(bool, enable_observability, false, - "Whether to enable GCP Observability"); - -static void sigint_handler(int /*x*/) { - gpr_atm_no_barrier_store(&grpc::testing::interop::g_got_sigint, true); -} - -int main(int argc, char** argv) { - grpc::testing::TestEnvironment env(&argc, argv); - grpc::testing::InitTest(&argc, &argv, true); - signal(SIGINT, sigint_handler); - - if (absl::GetFlag(FLAGS_enable_observability)) { - auto status = grpc::experimental::GcpObservabilityInit(); - gpr_log(GPR_DEBUG, "GcpObservabilityInit() status_code: %d", status.code()); - if (!status.ok()) { - return 1; - } - } - - grpc::testing::interop::RunServer( - grpc::testing::CreateInteropServerCredentials()); - - return 0; -} diff --git a/tools/buildgen/extract_metadata_from_bazel_xml.py b/tools/buildgen/extract_metadata_from_bazel_xml.py index b94762b0b43..507eadc6377 100755 --- a/tools/buildgen/extract_metadata_from_bazel_xml.py +++ b/tools/buildgen/extract_metadata_from_bazel_xml.py @@ -657,8 +657,7 @@ def _exclude_unwanted_cc_tests(tests: List[str]) -> List[str]: if not test.startswith('test/cpp/ext/filters/census:') and not test.startswith('test/core/xds:xds_channel_stack_modifier_test') and not test.startswith('test/cpp/ext/gcp:') and - not test.startswith('test/cpp/ext/filters/logging:') and - not test.startswith('test/cpp/interop:observability_interop') + not test.startswith('test/cpp/ext/filters/logging:') ] # missing opencensus/stats/stats.h diff --git a/tools/dockerfile/observability-test/cpp/Dockerfile b/tools/dockerfile/observability-test/cpp/Dockerfile deleted file mode 100644 index be985482782..00000000000 --- a/tools/dockerfile/observability-test/cpp/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2022 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# -# Stage 1: Build the interop test client and server -# - -FROM debian:bullseye as build - -RUN apt-get update && apt-get install -y clang curl git - -WORKDIR /grpc -COPY . . - -RUN git submodule update --init --recursive && \ - /grpc/tools/bazel build test/cpp/interop:observability_interop_test - - - -# -# Stage 2: -# -# - Copy only the necessary files to reduce Docker image size. -# - Have an ENTRYPOINT script which will launch the interop test client or server -# with the given parameters. -# - -FROM debian:bullseye - -ENV GRPC_TRACE environment_autodetect -ENV GRPC_VERBOSITY debug - - -WORKDIR /usr/share/grpc -COPY --from=build /grpc/etc/roots.pem . - - -WORKDIR /grpc/bazel-bin/test/cpp/interop -COPY --from=build /grpc/bazel-bin/test/cpp/interop/observability_interop_server . -COPY --from=build /grpc/bazel-bin/test/cpp/interop/observability_interop_client . - -WORKDIR /grpc/tools/dockerfile/observability-test/cpp -COPY --from=build /grpc/tools/dockerfile/observability-test/cpp/run.sh . - -ENTRYPOINT ["/grpc/tools/dockerfile/observability-test/cpp/run.sh"] diff --git a/tools/dockerfile/observability-test/cpp/build_docker.sh b/tools/dockerfile/observability-test/cpp/build_docker.sh deleted file mode 100755 index 7f85ce21554..00000000000 --- a/tools/dockerfile/observability-test/cpp/build_docker.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 2022 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex -cd "$(dirname "$0")"/../../../.. - -# Environment Variables: -# -# TAG_NAME: the docker image tag name -# - -echo Building ${TAG_NAME} - -docker build --no-cache -t ${TAG_NAME} -f ./tools/dockerfile/observability-test/cpp/Dockerfile . diff --git a/tools/dockerfile/observability-test/cpp/run.sh b/tools/dockerfile/observability-test/cpp/run.sh deleted file mode 100755 index 6dce8960a84..00000000000 --- a/tools/dockerfile/observability-test/cpp/run.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# Copyright 2022 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex -cd "$(dirname "$0")"/../.. - -# TODO(stanleycheung): replace positional parameters with explicit parameters -# -# $1: server | client -# -# For server: $2: server_port -# -# For client: $2: server_host -# $3: server_port -# $4: test_case -# $5: num_times - -if [ "$1" = "server" ] ; then - /grpc/bazel-bin/test/cpp/interop/observability_interop_server \ - --enable_observability=true --port $2 - -elif [ "$1" = "client" ] ; then - /grpc/bazel-bin/test/cpp/interop/observability_interop_client \ - --enable_observability=true \ - --server_host=$2 --server_port=$3 \ - --test_case=$4 --num_times=$5 - -else - echo "Invalid action: $1" - exit 1 -fi