diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | binding.gyp | 5 | ||||
-rw-r--r-- | src/core/lib/security/credentials/credentials.h | 2 | ||||
-rw-r--r-- | src/ruby/spec/generic/rpc_server_pool_spec.rb | 44 | ||||
-rw-r--r-- | templates/binding.gyp.template | 5 | ||||
-rw-r--r-- | test/core/security/credentials_test.c | 2 | ||||
-rw-r--r-- | tools/dockerfile/test/bazel/Dockerfile | 7 |
7 files changed, 45 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ed76368012..4e2234af7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9007,7 +9007,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX) add_executable(bm_cq_multiple_threads test/cpp/microbenchmarks/bm_cq_multiple_threads.cc - third_party/googletest/src/gtest-all.cc + third_party/googletest/googletest/src/gtest-all.cc ) @@ -9024,8 +9024,8 @@ target_include_directories(bm_cq_multiple_threads PRIVATE ${CARES_PLATFORM_INCLUDE_DIR} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include - PRIVATE third_party/googletest/include - PRIVATE third_party/googletest + PRIVATE third_party/googletest/googletest/include + PRIVATE third_party/googletest/googletest PRIVATE ${_gRPC_PROTO_GENS_DIR} ) diff --git a/binding.gyp b/binding.gyp index e9ea3a4e4c..6e3db8109e 100644 --- a/binding.gyp +++ b/binding.gyp @@ -519,9 +519,10 @@ # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. 'target_name': 'WINDOWS_BUILD_WARNING', - 'actions': [ + 'rules': [ { - 'action_name': 'WINDOWS_BUILD_WARNING', + 'rule_name': 'WINDOWS_BUILD_WARNING', + 'extension': 'S', 'inputs': [ 'package.json' ], diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h index 510b79552a..89b8e3c0b3 100644 --- a/src/core/lib/security/credentials/credentials.h +++ b/src/core/lib/security/credentials/credentials.h @@ -71,7 +71,7 @@ typedef enum { #define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60 -#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata" +#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata.google.internal" #define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \ "/computeMetadata/v1/instance/service-accounts/default/token" diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb index 69e8222cb9..0803ca74ed 100644 --- a/src/ruby/spec/generic/rpc_server_pool_spec.rb +++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb @@ -52,28 +52,31 @@ describe GRPC::Pool do expect(p.ready_for_work?).to be(false) end - it 'it stops being ready after all workers jobs waiting or running' do + it 'it stops being ready after all workers are busy' do p = Pool.new(5) p.start - job = proc { sleep(3) } # sleep so workers busy when done scheduling - 5.times do - expect(p.ready_for_work?).to be(true) - p.schedule(&job) + + wait_mu = Mutex.new + wait_cv = ConditionVariable.new + wait = true + + job = proc do + wait_mu.synchronize do + wait_cv.wait(wait_mu) while wait + end end - expect(p.ready_for_work?).to be(false) - end - it 'it becomes ready again after jobs complete' do - p = Pool.new(5) - p.start - job = proc {} 5.times do expect(p.ready_for_work?).to be(true) p.schedule(&job) end + expect(p.ready_for_work?).to be(false) - sleep 5 # give the pool time do get at least one task done - expect(p.ready_for_work?).to be(true) + + wait_mu.synchronize do + wait = false + wait_cv.broadcast + end end end @@ -105,13 +108,20 @@ describe GRPC::Pool do it 'stops jobs when there are long running jobs' do p = Pool.new(1) p.start - o, q = Object.new, Queue.new + + wait_forever_mu = Mutex.new + wait_forever_cv = ConditionVariable.new + wait_forever = true + + job_running = Queue.new job = proc do - sleep(5) # long running - q.push(o) + job_running.push(Object.new) + wait_forever_mu.synchronize do + wait_forever_cv.wait while wait_forever + end end p.schedule(&job) - sleep(1) # should ensure the long job gets scheduled + job_running.pop expect { p.stop }.not_to raise_error end end diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index aeeb56b9a6..55a91c5b93 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -217,9 +217,10 @@ # the OpenSSL headers, from the downloaded Node development package, # which is typically located in `.node-gyp` in your home directory. 'target_name': 'WINDOWS_BUILD_WARNING', - 'actions': [ + 'rules': [ { - 'action_name': 'WINDOWS_BUILD_WARNING', + 'rule_name': 'WINDOWS_BUILD_WARNING', + 'extension': 'S', 'inputs': [ 'package.json' ], diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index c0933c64a6..9bdce71ba0 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -582,7 +582,7 @@ static void on_oauth2_creds_get_metadata_failure( static void validate_compute_engine_http_request( const grpc_httpcli_request *request) { GPR_ASSERT(request->handshaker != &grpc_httpcli_ssl); - GPR_ASSERT(strcmp(request->host, "metadata") == 0); + GPR_ASSERT(strcmp(request->host, "metadata.google.internal") == 0); GPR_ASSERT( strcmp(request->http.path, "/computeMetadata/v1/instance/service-accounts/default/token") == diff --git a/tools/dockerfile/test/bazel/Dockerfile b/tools/dockerfile/test/bazel/Dockerfile index cc41384833..6ea8ef316c 100644 --- a/tools/dockerfile/test/bazel/Dockerfile +++ b/tools/dockerfile/test/bazel/Dockerfile @@ -72,6 +72,13 @@ RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add - RUN apt-get -y update RUN apt-get -y install bazel +# Pin Bazel to 0.4.4 +# Installing Bazel via apt-get first is required before installing 0.4.4 to +# allow gRPC to build without errors. See https://github.com/grpc/grpc/issues/10553 +RUN curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/0.4.4/bazel-0.4.4-installer-linux-x86_64.sh +RUN chmod +x ./bazel-0.4.4-installer-linux-x86_64.sh +RUN ./bazel-0.4.4-installer-linux-x86_64.sh + RUN mkdir -p /var/local/jenkins # Define the default command. |