From ad57b266c7d00ff846b890b25bf2828e40042ed4 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Mon, 27 Jun 2016 20:46:37 -0700 Subject: Fix metrics client logging --- test/cpp/interop/metrics_client.cc | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'test/cpp') diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index 7a0cb994df..e68c0379a3 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -56,6 +56,9 @@ using grpc::testing::GaugeResponse; using grpc::testing::MetricsService; using grpc::testing::MetricsServiceImpl; +// Do not log anything +void BlackholeLogger(gpr_log_func_args* args) {} + // Prints the values of all Gauges (unless total_only is set to 'true' in which // case this only prints the sum of all gauge values). bool PrintMetrics(std::unique_ptr stub, bool total_only, @@ -76,21 +79,21 @@ bool PrintMetrics(std::unique_ptr stub, bool total_only, while (reader->Read(&gauge_response)) { if (gauge_response.value_case() == GaugeResponse::kLongValue) { if (!total_only) { - gpr_log(GPR_INFO, "%s: %lld", gauge_response.name().c_str(), - gauge_response.long_value()); + std::cout << gauge_response.name() << ": " + << gauge_response.long_value() << std::endl; } overall_qps += gauge_response.long_value(); } else { - gpr_log(GPR_INFO, "Gauge %s is not a long value", - gauge_response.name().c_str()); + std::cout << "Gauge %s is not a long value" << gauge_response.name() + << std::endl; } } - gpr_log(GPR_INFO, "%ld", overall_qps); + std::cout << overall_qps << std::endl; const grpc::Status status = reader->Finish(); if (!status.ok()) { - gpr_log(GPR_ERROR, "Error in getting metrics from the client"); + std::cout << "Error in getting metrics from the client" << std::endl; } return status.ok(); @@ -99,14 +102,10 @@ bool PrintMetrics(std::unique_ptr stub, bool total_only, int main(int argc, char** argv) { grpc::testing::InitTest(&argc, &argv, true); - // Make sure server_addresses flag is not empty - if (FLAGS_metrics_server_address.empty()) { - gpr_log( - GPR_ERROR, - "Cannot connect to the Metrics server. Please pass the address of the" - "metrics server to connect to via the 'metrics_server_address' flag"); - return 1; - } + // The output of metrics client is in some cases programatically parsed (for + // example by the stress test framework). So, we do not want any of the log + // from the grpc library appearing on stdout. + gpr_set_log_function(BlackholeLogger); std::shared_ptr channel(grpc::CreateChannel( FLAGS_metrics_server_address, grpc::InsecureChannelCredentials())); -- cgit v1.2.3 From 18a0e4797023e0188b86048c4ac55834f1f46763 Mon Sep 17 00:00:00 2001 From: Sree Kuchibhotla Date: Wed, 29 Jun 2016 12:04:09 -0700 Subject: Fix cout error string --- test/cpp/interop/metrics_client.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/cpp') diff --git a/test/cpp/interop/metrics_client.cc b/test/cpp/interop/metrics_client.cc index e68c0379a3..179de30805 100644 --- a/test/cpp/interop/metrics_client.cc +++ b/test/cpp/interop/metrics_client.cc @@ -84,7 +84,7 @@ bool PrintMetrics(std::unique_ptr stub, bool total_only, } overall_qps += gauge_response.long_value(); } else { - std::cout << "Gauge %s is not a long value" << gauge_response.name() + std::cout << "Gauge '" << gauge_response.name() << "' is not long valued" << std::endl; } } -- cgit v1.2.3 From eda85c6765bf9b201fe5fa3185b704490f14026e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 1 Jul 2016 12:45:19 -0700 Subject: Expunge all references to zookeeper --- Makefile | 96 +-------- doc/naming.md | 22 --- include/grpc/grpc_zookeeper.h | 59 ------ src/core/ext/resolver/zookeeper/README.md | 1 - templates/Makefile.template | 199 ++----------------- .../dockerfile/run_tests_addons_nocache.include | 4 - test/build/zookeeper.c | 43 ---- test/cpp/end2end/shutdown_test.cc | 1 - test/cpp/end2end/zookeeper_test.cc | 219 --------------------- .../grpc_check_generated_pb_files/Dockerfile | 5 - .../interoptest/grpc_interop_csharp/Dockerfile | 4 - .../interoptest/grpc_interop_cxx/Dockerfile | 4 - .../interoptest/grpc_interop_node/Dockerfile | 4 - .../interoptest/grpc_interop_php/Dockerfile | 4 - .../interoptest/grpc_interop_python/Dockerfile | 4 - .../interoptest/grpc_interop_ruby/Dockerfile | 4 - .../grpc_interop_stress_node/Dockerfile | 4 - .../stress_test/grpc_interop_stress_php/Dockerfile | 4 - .../dockerfile/test/csharp_coreclr_x64/Dockerfile | 4 - tools/dockerfile/test/csharp_jessie_x64/Dockerfile | 4 - tools/dockerfile/test/cxx_jessie_x64/Dockerfile | 4 - tools/dockerfile/test/cxx_jessie_x86/Dockerfile | 4 - .../dockerfile/test/cxx_ubuntu1404_x64/Dockerfile | 4 - .../dockerfile/test/cxx_ubuntu1604_x64/Dockerfile | 4 - tools/dockerfile/test/cxx_wheezy_x64/Dockerfile | 4 - tools/dockerfile/test/fuzzer/Dockerfile | 4 - .../test/multilang_jessie_x64/Dockerfile | 4 - tools/dockerfile/test/node_jessie_x64/Dockerfile | 4 - tools/dockerfile/test/php_jessie_x64/Dockerfile | 4 - tools/dockerfile/test/python_jessie_x64/Dockerfile | 4 - tools/dockerfile/test/ruby_jessie_x64/Dockerfile | 4 - 31 files changed, 20 insertions(+), 713 deletions(-) delete mode 100644 include/grpc/grpc_zookeeper.h delete mode 100644 src/core/ext/resolver/zookeeper/README.md delete mode 100644 test/build/zookeeper.c delete mode 100644 test/cpp/end2end/zookeeper_test.cc (limited to 'test/cpp') diff --git a/Makefile b/Makefile index 8fd86e78ed..f1d908dce7 100644 --- a/Makefile +++ b/Makefile @@ -492,7 +492,6 @@ PROTOC_CHECK_CMD = which protoc > /dev/null PROTOC_CHECK_VERSION_CMD = protoc --version | grep -q libprotoc.3 DTRACE_CHECK_CMD = which dtrace > /dev/null SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS) -ZOOKEEPER_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zookeeper.c $(LDFLAGS) -lzookeeper_mt ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_PERFTOOLS ?= $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false) @@ -560,8 +559,6 @@ ifeq ($(HAS_SYSTEMTAP),true) CACHE_MK += HAS_SYSTEMTAP = true, endif -HAS_ZOOKEEPER = $(shell $(ZOOKEEPER_CHECK_CMD) 2> /dev/null && echo true || echo false) - # Note that for testing purposes, one can do: # make HAS_EMBEDDED_OPENSSL_ALPN=false # to emulate the fact we do not have OpenSSL in the third_party folder. @@ -705,14 +702,6 @@ PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) PC_LIB = -lgrpc GRPC_UNSECURE_PC_FILE := $(PC_TEMPLATE) -# grpc_zookeeper .pc file -PC_NAME = gRPC zookeeper -PC_DESCRIPTION = gRPC's zookeeper plugin -PC_CFLAGS = -PC_REQUIRES_PRIVATE = -PC_LIBS_PRIVATE = -lzookeeper_mt -GRPC_ZOOKEEPER_PC_FILE := $(PC_TEMPLATE) - PROTOBUF_PKG_CONFIG = false PC_REQUIRES_GRPCXX = @@ -1151,7 +1140,6 @@ run_dep_checks: $(PERFTOOLS_CHECK_CMD) || true $(PROTOBUF_CHECK_CMD) || true $(PROTOC_CHECK_VERSION_CMD) || true - $(ZOOKEEPER_CHECK_CMD) || true third_party/protobuf/configure: $(E) "[AUTOGEN] Preparing protobuf" @@ -1170,29 +1158,16 @@ $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure static: static_c static_cxx -static_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_cronet.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a static_zookeeper_libs - +static_c: pc_c pc_c_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_cronet.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_reflection.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a shared: shared_c shared_cxx -shared_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT) shared_zookeeper_libs - +shared_c: pc_c pc_c_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT) shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_reflection$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT) -ifeq ($(HAS_ZOOKEEPER),true) -static_zookeeper_libs: -shared_zookeeper_libs: -else - -static_zookeeper_libs: - -shared_zookeeper_libs: - -endif - grpc_csharp_ext: shared_csharp plugins: $(PROTOC_PLUGINS) @@ -1204,12 +1179,6 @@ pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc -ifeq ($(HAS_ZOOKEEPER),true) -pc_c_zookeeper: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc -else -pc_c_zookeeper: -endif - pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc @@ -1221,14 +1190,7 @@ privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG endif -ifeq ($(HAS_ZOOKEEPER),true) -privatelibs_zookeeper: -else -privatelibs_zookeeper: -endif - - -buildtests: buildtests_c buildtests_cxx buildtests_zookeeper +buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/alarm_test \ @@ -1388,7 +1350,7 @@ buildtests_c: privatelibs_c \ ifeq ($(EMBED_OPENSSL),true) -buildtests_cxx: buildtests_zookeeper privatelibs_cxx \ +buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/alarm_cpp_test \ $(BINDIR)/$(CONFIG)/async_end2end_test \ $(BINDIR)/$(CONFIG)/auth_property_iterator_test \ @@ -1472,7 +1434,7 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \ $(BINDIR)/$(CONFIG)/boringssl_ssl_test \ else -buildtests_cxx: buildtests_zookeeper privatelibs_cxx \ +buildtests_cxx: privatelibs_cxx \ $(BINDIR)/$(CONFIG)/alarm_cpp_test \ $(BINDIR)/$(CONFIG)/async_end2end_test \ $(BINDIR)/$(CONFIG)/auth_property_iterator_test \ @@ -1520,17 +1482,9 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \ endif -ifeq ($(HAS_ZOOKEEPER),true) -buildtests_zookeeper: privatelibs_zookeeper \ - -else -buildtests_zookeeper: -endif - - -test: test_c test_cxx test_zookeeper +test: test_c test_cxx -flaky_test: flaky_test_c flaky_test_cxx flaky_test_zookeeper +flaky_test: flaky_test_c flaky_test_cxx test_c: buildtests_c $(E) "[RUN] Testing alarm_test" @@ -1752,7 +1706,7 @@ flaky_test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/mlog_test || ( echo test mlog_test failed ; exit 1 ) -test_cxx: test_zookeeper buildtests_cxx +test_cxx: buildtests_cxx $(E) "[RUN] Testing alarm_cpp_test" $(Q) $(BINDIR)/$(CONFIG)/alarm_cpp_test || ( echo test alarm_cpp_test failed ; exit 1 ) $(E) "[RUN] Testing async_end2end_test" @@ -1818,18 +1772,6 @@ test_cxx: test_zookeeper buildtests_cxx flaky_test_cxx: buildtests_cxx -ifeq ($(HAS_ZOOKEEPER),true) -test_zookeeper: buildtests_zookeeper - - -flaky_test_zookeeper: buildtests_zookeeper - -else -test_zookeeper: -flaky_test_zookeeper: -endif - - test_python: static_c $(E) "[RUN] Testing python code" $(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG) @@ -1867,8 +1809,6 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc_cronet.a $(E) "[STRIP] Stripping libgrpc_unsecure.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a -ifeq ($(HAS_ZOOKEEPER),true) -endif endif strip-static_cxx: static_cxx @@ -1891,8 +1831,6 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_cronet$(SHARED_VERSION).$(SHARED_EXT) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT) -ifeq ($(HAS_ZOOKEEPER),true) -endif endif strip-shared_cxx: shared_cxx @@ -1925,11 +1863,6 @@ $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc: $(Q) mkdir -p $(@D) $(Q) echo "$(GRPC_UNSECURE_PC_FILE)" | tr , '\n' >$@ -$(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc: - $(E) "[MAKE] Generating $@" - $(Q) mkdir -p $(@D) - $(Q) echo "$(GRPC_ZOOKEEPER_PC_FILE)" | tr , '\n' >$@ - $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc: $(E) "[MAKE] Generating $@" $(Q) mkdir -p $(@D) @@ -2205,8 +2138,6 @@ install-static_c: static_c strip-static_c install-pkg-config_c $(E) "[INSTALL] Installing libgrpc_unsecure.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(prefix)/lib/libgrpc_unsecure.a -ifeq ($(HAS_ZOOKEEPER),true) -endif install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx $(E) "[INSTALL] Installing libgrpc++.a" @@ -2258,8 +2189,6 @@ else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc_unsecure.so.0 $(Q) ln -sf $(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc_unsecure.so endif -ifeq ($(HAS_ZOOKEEPER),true) -endif ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) $(Q) ldconfig || true @@ -2295,8 +2224,6 @@ else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++_unsecure.so.0 $(Q) ln -sf $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++_unsecure.so endif -ifeq ($(HAS_ZOOKEEPER),true) -endif ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) $(Q) ldconfig || true @@ -2314,8 +2241,6 @@ else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.so.0 $(Q) ln -sf $(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.so endif -ifeq ($(HAS_ZOOKEEPER),true) -endif ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) $(Q) ldconfig || true @@ -2342,14 +2267,11 @@ else $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin endif -install-pkg-config_c: pc_c pc_c_unsecure pc_c_zookeeper +install-pkg-config_c: pc_c pc_c_unsecure $(E) "[INSTALL] Installing C pkg-config files" $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc -ifeq ($(HAS_ZOOKEEPER),true) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc $(prefix)/lib/pkgconfig/grpc_zookeeper.pc -endif install-pkg-config_cxx: pc_cxx pc_cxx_unsecure $(E) "[INSTALL] Installing C++ pkg-config files" diff --git a/doc/naming.md b/doc/naming.md index 5ad7e6622e..d0c892e8d9 100644 --- a/doc/naming.md +++ b/doc/naming.md @@ -16,8 +16,6 @@ Here, scheme indicates the name-system to be used. Example schemes to be support * `dns` -* `zookeeper` - * `etcd` Authority indicates some scheme-specific bootstrap information, e.g., for DNS, the authority may include the IP[:port] of the DNS server to use. Often, a DNS name may used as the authority, since the ability to resolve DNS names is already built into all gRPC client libraries. @@ -30,23 +28,3 @@ The gRPC client library will switch on the scheme to pick the right resolver plu Resolvers should be able to contact the authority and get a resolution that they return back to the gRPC client library. The returned contents include a list of IP:port, an optional config and optional auth config data to be used for channel authentication. The plugin API allows the resolvers to continuously watch an endpoint_name and return updated resolutions as needed. -## Zookeeper - -Apache [ZooKeeper](https://zookeeper.apache.org/) is a popular solution for building name-systems. Curator is a service discovery system built on to of ZooKeeper. We propose to organize names hierarchically as `/path/service/instance` similar to Apache Curator. - -A fully-qualified ZooKeeper name used to construct a gRPC channel will look as follows: - -``` -zookeeper://host:port/path/service/instance -``` -Here `zookeeper` is the scheme identifying the name-system. `host:port` identifies an authoritative name-server for this scheme (i.e., a Zookeeper server). The host can be an IP address or a DNS name. -Finally `/path/service/instance` is the Zookeeper name to be resolved. - -## Service Registration - - -Service providers can register their services in Zookeeper by using a Zookeeper client. - -Each service is a zookeeper node, and each instance is a child node of the corresponding service. For example, a MySQL service may have multiple instances, `/mysql/1`, `/mysql/2`, `/mysql/3`. The name of the service or instance, as well as an optional path is specified by the service provider. - -The data in service nodes is empty. Each instance node stores its address in the format of `host:port`, where host can be either hostname or IP address. diff --git a/include/grpc/grpc_zookeeper.h b/include/grpc/grpc_zookeeper.h deleted file mode 100644 index 2b195c18bf..0000000000 --- a/include/grpc/grpc_zookeeper.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/** Support zookeeper as alternative name system in addition to DNS - * Zookeeper name in gRPC is represented as a URI: - * zookeeper://host:port/path/service/instance - * - * Where zookeeper is the name system scheme - * host:port is the address of a zookeeper server - * /path/service/instance is the zookeeper name to be resolved - * - * Refer doc/naming.md for more details - */ - -#ifndef GRPC_GRPC_ZOOKEEPER_H -#define GRPC_GRPC_ZOOKEEPER_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** Register zookeeper name resolver in grpc */ -void grpc_zookeeper_register(); - -#ifdef __cplusplus -} -#endif - -#endif /* GRPC_GRPC_ZOOKEEPER_H */ diff --git a/src/core/ext/resolver/zookeeper/README.md b/src/core/ext/resolver/zookeeper/README.md deleted file mode 100644 index ce6f39683b..0000000000 --- a/src/core/ext/resolver/zookeeper/README.md +++ /dev/null @@ -1 +0,0 @@ -Zookeeper based name resolver: WIP diff --git a/templates/Makefile.template b/templates/Makefile.template index 0e3b9926b7..0cbd8bfdd5 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -380,7 +380,6 @@ PROTOC_CHECK_VERSION_CMD = protoc --version | grep -q libprotoc.3 DTRACE_CHECK_CMD = which dtrace > /dev/null SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS) - ZOOKEEPER_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zookeeper.c $(LDFLAGS) -lzookeeper_mt ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_PERFTOOLS ?= $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false) @@ -448,8 +447,6 @@ CACHE_MK += HAS_SYSTEMTAP = true, endif - HAS_ZOOKEEPER = $(shell $(ZOOKEEPER_CHECK_CMD) 2> /dev/null && echo true || echo false) - # Note that for testing purposes, one can do: # make HAS_EMBEDDED_OPENSSL_ALPN=false # to emulate the fact we do not have OpenSSL in the third_party folder. @@ -593,14 +590,6 @@ PC_LIB = -lgrpc GRPC_UNSECURE_PC_FILE := $(PC_TEMPLATE) - # grpc_zookeeper .pc file - PC_NAME = gRPC zookeeper - PC_DESCRIPTION = gRPC's zookeeper plugin - PC_CFLAGS = - PC_REQUIRES_PRIVATE = - PC_LIBS_PRIVATE = -lzookeeper_mt - GRPC_ZOOKEEPER_PC_FILE := $(PC_TEMPLATE) - PROTOBUF_PKG_CONFIG = false PC_REQUIRES_GRPCXX = @@ -796,7 +785,6 @@ $(PERFTOOLS_CHECK_CMD) || true $(PROTOBUF_CHECK_CMD) || true $(PROTOC_CHECK_VERSION_CMD) || true - $(ZOOKEEPER_CHECK_CMD) || true third_party/protobuf/configure: $(E) "[AUTOGEN] Preparing protobuf" @@ -815,7 +803,7 @@ static: static_c static_cxx - static_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper\ + static_c: pc_c pc_c_unsecure cache.mk \ % for lib in libs: % if 'Makefile' in lib.get('build_system', ['Makefile']): % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None): @@ -823,7 +811,6 @@ % endif % endif % endfor - static_zookeeper_libs static_cxx: pc_cxx pc_cxx_unsecure cache.mk \ @@ -838,7 +825,7 @@ shared: shared_c shared_cxx - shared_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper\ + shared_c: pc_c pc_c_unsecure cache.mk\ % for lib in libs: % if 'Makefile' in lib.get('build_system', ['Makefile']): % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None): @@ -846,7 +833,6 @@ % endif % endif % endfor - shared_zookeeper_libs shared_cxx: pc_cxx pc_cxx_unsecure cache.mk\ % for lib in libs: @@ -867,33 +853,6 @@ % endif % endfor - ifeq ($(HAS_ZOOKEEPER),true) - static_zookeeper_libs:\ - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): - $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ - % endif - % endif - % endfor - - shared_zookeeper_libs:\ - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): - $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)\ - % endif - % endif - % endfor - - else - - static_zookeeper_libs: - - shared_zookeeper_libs: - - endif - grpc_csharp_ext: shared_csharp plugins: $(PROTOC_PLUGINS) @@ -913,12 +872,6 @@ pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc - ifeq ($(HAS_ZOOKEEPER),true) - pc_c_zookeeper: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc - else - pc_c_zookeeper: - endif - pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc @@ -932,7 +885,7 @@ % endif % endif % endfor - + else privatelibs_cxx: \ % for lib in libs: @@ -942,26 +895,11 @@ % endif % endif % endfor - - endif - - - ifeq ($(HAS_ZOOKEEPER),true) - privatelibs_zookeeper: \ - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.build == 'private' and lib.language == 'c++' and zookeeper in lib.get('external_deps', []): - $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ - % endif - % endif - % endfor - else - privatelibs_zookeeper: endif - buildtests: buildtests_c buildtests_cxx buildtests_zookeeper + buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c <%text>\ % for tgt in targets: @@ -972,40 +910,27 @@ ifeq ($(EMBED_OPENSSL),true) - buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\ + buildtests_cxx: privatelibs_cxx <%text>\ % for tgt in targets: % if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None): $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\ % endif % endfor - + else - buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\ + buildtests_cxx: privatelibs_cxx <%text>\ % for tgt in targets: % if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None) and not tgt.boringssl: $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\ % endif % endfor - - endif - - - ifeq ($(HAS_ZOOKEEPER),true) - buildtests_zookeeper: privatelibs_zookeeper <%text>\ - % for tgt in targets: - % if tgt.build == 'test' and tgt.language == 'c++' and 'zookeeper' in tgt.get('external_deps', []): - $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\ - % endif - % endfor - else - buildtests_zookeeper: endif - test: test_c test_cxx test_zookeeper + test: test_c test_cxx - flaky_test: flaky_test_c flaky_test_cxx flaky_test_zookeeper + flaky_test: flaky_test_c flaky_test_cxx test_c: buildtests_c % for tgt in targets: @@ -1025,7 +950,7 @@ % endfor - test_cxx: test_zookeeper buildtests_cxx + test_cxx: buildtests_cxx % for tgt in targets: % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None): $(E) "[RUN] Testing ${tgt.name}" @@ -1043,30 +968,6 @@ % endfor - ifeq ($(HAS_ZOOKEEPER),true) - test_zookeeper: buildtests_zookeeper - % for tgt in targets: - % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []): - $(E) "[RUN] Testing ${tgt.name}" - $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) - % endif - % endfor - - - flaky_test_zookeeper: buildtests_zookeeper - % for tgt in targets: - % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []): - $(E) "[RUN] Testing ${tgt.name}" - $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) - % endif - % endfor - - else - test_zookeeper: - flaky_test_zookeeper: - endif - - test_python: static_c $(E) "[RUN] Testing python code" $(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG) @@ -1126,20 +1027,6 @@ % endif % endif % endfor - ifeq ($(HAS_ZOOKEEPER),true) - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.language == "c": - % if lib.build == "all": - % if 'zookeeper' in lib.get('external_deps', []): - $(E) "[STRIP] Stripping lib${lib.name}.a" - $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a - % endif - % endif - % endif - % endif - % endfor - endif endif strip-static_cxx: static_cxx @@ -1170,20 +1057,6 @@ % endif % endif % endfor - ifeq ($(HAS_ZOOKEEPER),true) - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.language == "c": - % if lib.build == "all": - % if 'zookeeper' in lib.get('external_deps', []): - $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)" - $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) - % endif - % endif - % endif - % endif - % endfor - endif endif strip-shared_cxx: shared_cxx @@ -1228,11 +1101,6 @@ $(Q) mkdir -p $(@D) $(Q) echo "$(GRPC_UNSECURE_PC_FILE)" | tr , '\n' >$@ - $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc: - $(E) "[MAKE] Generating $@" - $(Q) mkdir -p $(@D) - $(Q) echo "$(GRPC_ZOOKEEPER_PC_FILE)" | tr , '\n' >$@ - $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc: $(E) "[MAKE] Generating $@" $(Q) mkdir -p $(@D) @@ -1331,21 +1199,6 @@ % endif % endif % endfor - ifeq ($(HAS_ZOOKEEPER),true) - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.language == "c": - % if lib.build == "all": - % if 'zookeeper' in lib.get('external_deps', []): - $(E) "[INSTALL] Installing lib${lib.name}.a" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a - % endif - % endif - % endif - % endif - % endfor - endif install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx % for lib in libs: @@ -1380,27 +1233,6 @@ % endif % endif % endfor - ifeq ($(HAS_ZOOKEEPER),true) - % for lib in libs: - % if 'Makefile' in lib.get('build_system', ['Makefile']): - % if lib.language == lang_filter: - % if lib.build == "all": - % if 'zookeeper' in lib.get('external_deps', []): - $(E) "[INSTALL] Installing $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)" - $(Q) $(INSTALL) -d $(prefix)/lib - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) - ifeq ($(SYSTEM),MINGW32) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a - else ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.core_version.major} - $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so - endif - % endif - % endif - % endif - % endif - % endfor - endif ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) $(Q) ldconfig || true @@ -1430,14 +1262,11 @@ % endfor endif - install-pkg-config_c: pc_c pc_c_unsecure pc_c_zookeeper + install-pkg-config_c: pc_c pc_c_unsecure $(E) "[INSTALL] Installing C pkg-config files" $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc - ifeq ($(HAS_ZOOKEEPER),true) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc $(prefix)/lib/pkgconfig/grpc_zookeeper.pc - endif install-pkg-config_cxx: pc_cxx pc_cxx_unsecure $(E) "[INSTALL] Installing C++ pkg-config files" @@ -1645,9 +1474,6 @@ for src in lib.src: sources_that_don_t_need_openssl.add(src) - if 'zookeeper' in lib.get('external_deps', []): - libs = libs + ' -lzookeeper_mt' - if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': lib_deps = lib_deps + ' $(OPENSSL_DEP)' mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)' @@ -1802,9 +1628,6 @@ % for dep in tgt.deps: $(LIBDIR)/$(CONFIG)/lib${dep}.a\ % endfor - % if 'zookeeper' in tgt.get('external_deps', []): - -lzookeeper_mt\ - % endif % if tgt.language == "c++": % if tgt.build == 'protoc': $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC)\ diff --git a/templates/tools/dockerfile/run_tests_addons_nocache.include b/templates/tools/dockerfile/run_tests_addons_nocache.include index 242a1acfb3..74b01e386c 100644 --- a/templates/tools/dockerfile/run_tests_addons_nocache.include +++ b/templates/tools/dockerfile/run_tests_addons_nocache.include @@ -1,6 +1,2 @@ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/test/build/zookeeper.c b/test/build/zookeeper.c deleted file mode 100644 index 7cd3d0da9e..0000000000 --- a/test/build/zookeeper.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* This is just a compilation test, to see if we have Zookeeper C client - library installed. */ - -#include -#include - -int main() { - zookeeper_init(NULL, NULL, 0, 0, 0, 0); - return 0; -} diff --git a/test/cpp/end2end/shutdown_test.cc b/test/cpp/end2end/shutdown_test.cc index aa8d42141d..3f98de6db7 100644 --- a/test/cpp/end2end/shutdown_test.cc +++ b/test/cpp/end2end/shutdown_test.cc @@ -123,7 +123,6 @@ class ShutdownTest : public ::testing::Test { TestServiceImpl service_; }; -// Tests zookeeper state change between two RPCs // TODO(ctiller): leaked objects in this test TEST_F(ShutdownTest, ShutdownTest) { ResetStub(); diff --git a/test/cpp/end2end/zookeeper_test.cc b/test/cpp/end2end/zookeeper_test.cc deleted file mode 100644 index fdc500e535..0000000000 --- a/test/cpp/end2end/zookeeper_test.cc +++ /dev/null @@ -1,219 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "src/core/lib/support/env.h" -#include "src/proto/grpc/testing/echo.grpc.pb.h" -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" - -using grpc::testing::EchoRequest; -using grpc::testing::EchoResponse; - -namespace grpc { -namespace testing { - -class ZookeeperTestServiceImpl - : public ::grpc::testing::EchoTestService::Service { - public: - Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) GRPC_OVERRIDE { - response->set_message(request->message()); - return Status::OK; - } -}; - -class ZookeeperTest : public ::testing::Test { - protected: - ZookeeperTest() {} - - void SetUp() GRPC_OVERRIDE { - SetUpZookeeper(); - - // Sets up two servers - int port1 = grpc_pick_unused_port_or_die(); - server1_ = SetUpServer(port1); - - int port2 = grpc_pick_unused_port_or_die(); - server2_ = SetUpServer(port2); - - // Registers service /test in zookeeper - RegisterService("/test", "test"); - - // Registers service instance /test/1 in zookeeper - string value = - "{\"host\":\"localhost\",\"port\":\"" + to_string(port1) + "\"}"; - RegisterService("/test/1", value); - - // Registers service instance /test/2 in zookeeper - value = "{\"host\":\"localhost\",\"port\":\"" + to_string(port2) + "\"}"; - RegisterService("/test/2", value); - } - - // Requires zookeeper server running - void SetUpZookeeper() { - // Finds zookeeper server address in environment - // Default is localhost:2181 - zookeeper_address_ = "localhost:2181"; - char* addr = gpr_getenv("GRPC_ZOOKEEPER_SERVER_TEST"); - if (addr != NULL) { - string addr_str(addr); - zookeeper_address_ = addr_str; - gpr_free(addr); - } - gpr_log(GPR_DEBUG, "%s", zookeeper_address_.c_str()); - - // Connects to zookeeper server - zoo_set_debug_level(ZOO_LOG_LEVEL_WARN); - zookeeper_handle_ = - zookeeper_init(zookeeper_address_.c_str(), NULL, 15000, 0, 0, 0); - GPR_ASSERT(zookeeper_handle_ != NULL); - - // Registers zookeeper name resolver in grpc - grpc_zookeeper_register(); - } - - std::unique_ptr SetUpServer(const int port) { - string server_address = "localhost:" + to_string(port); - - ServerBuilder builder; - builder.AddListeningPort(server_address, InsecureServerCredentials()); - builder.RegisterService(&service_); - std::unique_ptr server = builder.BuildAndStart(); - return server; - } - - void RegisterService(const string& name, const string& value) { - char* path = (char*)gpr_malloc(name.size()); - - int status = zoo_exists(zookeeper_handle_, name.c_str(), 0, NULL); - if (status == ZNONODE) { - status = - zoo_create(zookeeper_handle_, name.c_str(), value.c_str(), - value.size(), &ZOO_OPEN_ACL_UNSAFE, 0, path, name.size()); - } else { - status = zoo_set(zookeeper_handle_, name.c_str(), value.c_str(), - value.size(), -1); - } - gpr_free(path); - GPR_ASSERT(status == 0); - } - - void DeleteService(const string& name) { - int status = zoo_delete(zookeeper_handle_, name.c_str(), -1); - GPR_ASSERT(status == 0); - } - - void ChangeZookeeperState() { - server1_->Shutdown(); - DeleteService("/test/1"); - } - - void TearDown() GRPC_OVERRIDE { - server1_->Shutdown(); - server2_->Shutdown(); - zookeeper_close(zookeeper_handle_); - } - - void ResetStub() { - string target = "zookeeper://" + zookeeper_address_ + "/test"; - channel_ = CreateChannel(target, InsecureChannelCredentials()); - stub_ = grpc::testing::EchoTestService::NewStub(channel_); - } - - string to_string(const int number) { - std::stringstream strs; - strs << number; - return strs.str(); - } - - std::shared_ptr channel_; - std::unique_ptr stub_; - std::unique_ptr server1_; - std::unique_ptr server2_; - ZookeeperTestServiceImpl service_; - zhandle_t* zookeeper_handle_; - string zookeeper_address_; -}; - -// Tests zookeeper state change between two RPCs -// TODO(ctiller): leaked objects in this test -TEST_F(ZookeeperTest, ZookeeperStateChangeTwoRpc) { - ResetStub(); - - // First RPC - EchoRequest request1; - EchoResponse response1; - ClientContext context1; - context1.set_authority("test"); - request1.set_message("Hello"); - Status s1 = stub_->Echo(&context1, request1, &response1); - EXPECT_EQ(response1.message(), request1.message()); - EXPECT_TRUE(s1.ok()); - - // Zookeeper state changes - gpr_log(GPR_DEBUG, "Zookeeper state change"); - ChangeZookeeperState(); - // Waits for re-resolving addresses - // TODO(ctiller): RPC will probably fail if not waiting - sleep(1); - - // Second RPC - EchoRequest request2; - EchoResponse response2; - ClientContext context2; - context2.set_authority("test"); - request2.set_message("World"); - Status s2 = stub_->Echo(&context2, request2, &response2); - EXPECT_EQ(response2.message(), request2.message()); - EXPECT_TRUE(s2.ok()); -} - -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc_test_init(argc, argv); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/tools/dockerfile/grpc_check_generated_pb_files/Dockerfile b/tools/dockerfile/grpc_check_generated_pb_files/Dockerfile index 7658991462..d19bc67120 100644 --- a/tools/dockerfile/grpc_check_generated_pb_files/Dockerfile +++ b/tools/dockerfile/grpc_check_generated_pb_files/Dockerfile @@ -67,11 +67,6 @@ RUN apt-get update && apt-get install -y time && apt-get clean # C++ dependencies RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev - RUN mkdir /var/local/jenkins # Define the default command. diff --git a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile index baab2f5638..150dde4f21 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile @@ -88,10 +88,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/interoptest/grpc_interop_cxx/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_cxx/Dockerfile index 2bbccca9e5..bbd903e269 100644 --- a/tools/dockerfile/interoptest/grpc_interop_cxx/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_cxx/Dockerfile @@ -75,10 +75,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/interoptest/grpc_interop_node/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_node/Dockerfile index 2a8d35a5dc..be07094cd2 100644 --- a/tools/dockerfile/interoptest/grpc_interop_node/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_node/Dockerfile @@ -82,10 +82,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile index e27a6a2301..af83ee6164 100644 --- a/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_php/Dockerfile @@ -100,10 +100,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile index 071fb2c93b..db01e301de 100644 --- a/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile @@ -86,10 +86,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile index df8eef5438..88b513032a 100644 --- a/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_ruby/Dockerfile @@ -86,10 +86,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_node/Dockerfile b/tools/dockerfile/stress_test/grpc_interop_stress_node/Dockerfile index 4fd7cc29a3..0738e95e9b 100644 --- a/tools/dockerfile/stress_test/grpc_interop_stress_node/Dockerfile +++ b/tools/dockerfile/stress_test/grpc_interop_stress_node/Dockerfile @@ -87,10 +87,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile b/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile index c29aaf7c3f..3092bd955e 100644 --- a/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile +++ b/tools/dockerfile/stress_test/grpc_interop_stress_php/Dockerfile @@ -105,10 +105,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile index fd7215716d..98515aa5d7 100644 --- a/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_coreclr_x64/Dockerfile @@ -103,10 +103,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/csharp_jessie_x64/Dockerfile b/tools/dockerfile/test/csharp_jessie_x64/Dockerfile index baab2f5638..150dde4f21 100644 --- a/tools/dockerfile/test/csharp_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/csharp_jessie_x64/Dockerfile @@ -88,10 +88,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/cxx_jessie_x64/Dockerfile b/tools/dockerfile/test/cxx_jessie_x64/Dockerfile index 6492158929..a8aa74dd0e 100644 --- a/tools/dockerfile/test/cxx_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/cxx_jessie_x64/Dockerfile @@ -108,10 +108,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/cxx_jessie_x86/Dockerfile b/tools/dockerfile/test/cxx_jessie_x86/Dockerfile index 92c9c4ce86..abd3e42f26 100644 --- a/tools/dockerfile/test/cxx_jessie_x86/Dockerfile +++ b/tools/dockerfile/test/cxx_jessie_x86/Dockerfile @@ -75,10 +75,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/cxx_ubuntu1404_x64/Dockerfile b/tools/dockerfile/test/cxx_ubuntu1404_x64/Dockerfile index 5982c9783e..5ef25e80b4 100644 --- a/tools/dockerfile/test/cxx_ubuntu1404_x64/Dockerfile +++ b/tools/dockerfile/test/cxx_ubuntu1404_x64/Dockerfile @@ -67,10 +67,6 @@ RUN apt-get update && apt-get install -y time && apt-get clean # C++ dependencies RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile b/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile index d356433163..c65fc61977 100644 --- a/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile +++ b/tools/dockerfile/test/cxx_ubuntu1604_x64/Dockerfile @@ -75,10 +75,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile b/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile index dd9a79b1ed..9d5dd52c18 100644 --- a/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile +++ b/tools/dockerfile/test/cxx_wheezy_x64/Dockerfile @@ -86,10 +86,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/fuzzer/Dockerfile b/tools/dockerfile/test/fuzzer/Dockerfile index 6ba31114ab..3ac134ad7d 100644 --- a/tools/dockerfile/test/fuzzer/Dockerfile +++ b/tools/dockerfile/test/fuzzer/Dockerfile @@ -108,10 +108,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/multilang_jessie_x64/Dockerfile b/tools/dockerfile/test/multilang_jessie_x64/Dockerfile index 5c3f77405e..5e5969cda2 100644 --- a/tools/dockerfile/test/multilang_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/multilang_jessie_x64/Dockerfile @@ -147,10 +147,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/node_jessie_x64/Dockerfile b/tools/dockerfile/test/node_jessie_x64/Dockerfile index 2a8d35a5dc..be07094cd2 100644 --- a/tools/dockerfile/test/node_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/node_jessie_x64/Dockerfile @@ -82,10 +82,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/php_jessie_x64/Dockerfile b/tools/dockerfile/test/php_jessie_x64/Dockerfile index d8d27846c1..e477295722 100644 --- a/tools/dockerfile/test/php_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/php_jessie_x64/Dockerfile @@ -85,10 +85,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/python_jessie_x64/Dockerfile b/tools/dockerfile/test/python_jessie_x64/Dockerfile index 071fb2c93b..db01e301de 100644 --- a/tools/dockerfile/test/python_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/python_jessie_x64/Dockerfile @@ -86,10 +86,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins diff --git a/tools/dockerfile/test/ruby_jessie_x64/Dockerfile b/tools/dockerfile/test/ruby_jessie_x64/Dockerfile index df8eef5438..88b513032a 100644 --- a/tools/dockerfile/test/ruby_jessie_x64/Dockerfile +++ b/tools/dockerfile/test/ruby_jessie_x64/Dockerfile @@ -86,10 +86,6 @@ RUN ln -s /usr/bin/ccache /usr/local/bin/c++ RUN ln -s /usr/bin/ccache /usr/local/bin/clang RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ -#====================== -# Zookeeper dependencies -# TODO(jtattermusch): is zookeeper still needed? -RUN apt-get install -y libzookeeper-mt-dev RUN mkdir /var/local/jenkins -- cgit v1.2.3