This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch branch-4.11
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.11 by this push:
     new 055639c  Fix hanging tests tests TestStorageServerClientManagerImpl
055639c is described below

commit 055639cf8dc9e0b32792fb7e04fff3e82380a65b
Author: pkumar-singh <[email protected]>
AuthorDate: Tue Feb 9 03:48:13 2021 -0800

    Fix hanging tests tests TestStorageServerClientManagerImpl
    
    Descriptions of the changes in this PR:
    
    **Motivation**
    Fixing hanging tests TestStorageServerClientManagerImpl and other tests in 
the directory
    
    Some tests were not running because they were hanging waiting on future 
while storage container was being fetched.
    But inproc grpc server was running on endpoint fake-server while client was 
connecting on fake-server:4181
    
    **Changes**
    Make GRPC inproc server run on fake-server:4181 and client connect on 
fake-server:4181
    
    Reviewers: Enrico Olivelli <[email protected]>, Andrey Yegorov 
<[email protected]>
    
    This closes #2587 from pkumar-singh/fix_hanging_unit_tests
    
    (cherry picked from commit 8b22a7b9d828c699a3fa62071ae4fecc62248201)
    Signed-off-by: Enrico Olivelli <[email protected]>
---
 .../apache/bookkeeper/clients/impl/internal/LocationClientImpl.java   | 4 ++++
 .../clients/impl/internal/RootRangeClientImplWithRetries.java         | 1 +
 .../java/org/apache/bookkeeper/clients/grpc/GrpcClientTestBase.java   | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/LocationClientImpl.java
 
b/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/LocationClientImpl.java
index 8b589c3..22a1df7 100644
--- 
a/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/LocationClientImpl.java
+++ 
b/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/LocationClientImpl.java
@@ -32,6 +32,8 @@ import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.function.Predicate;
 import java.util.stream.Stream;
+
+import lombok.extern.slf4j.Slf4j;
 import org.apache.bookkeeper.clients.config.StorageClientSettings;
 import org.apache.bookkeeper.clients.impl.internal.api.LocationClient;
 import org.apache.bookkeeper.clients.utils.ClientConstants;
@@ -49,6 +51,7 @@ import 
org.apache.bookkeeper.stream.proto.storage.StorageContainerServiceGrpc.St
 /**
  * Default Implementation of {@link LocationClient}.
  */
+@Slf4j
 public class LocationClientImpl implements LocationClient {
 
     private final StorageClientSettings settings;
@@ -81,6 +84,7 @@ public class LocationClientImpl implements LocationClient {
         cause -> shouldRetryOnException(cause);
 
     private static boolean shouldRetryOnException(Throwable cause) {
+        log.error("Not able to locate storage container {}", cause);
         if (cause instanceof StatusRuntimeException || cause instanceof 
StatusException) {
             Status status;
             if (cause instanceof StatusException) {
diff --git 
a/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/RootRangeClientImplWithRetries.java
 
b/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/RootRangeClientImplWithRetries.java
index ba2c247..210947a 100644
--- 
a/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/RootRangeClientImplWithRetries.java
+++ 
b/stream/clients/java/base/src/main/java/org/apache/bookkeeper/clients/impl/internal/RootRangeClientImplWithRetries.java
@@ -46,6 +46,7 @@ class RootRangeClientImplWithRetries implements 
RootRangeClient {
         cause -> shouldRetryOnException(cause);
 
     private static boolean shouldRetryOnException(Throwable cause) {
+        log.error("Reason for the failure {}", cause);
         if (cause instanceof StatusRuntimeException || cause instanceof 
StatusException) {
             Status status;
             if (cause instanceof StatusException) {
diff --git 
a/stream/clients/java/base/src/test/java/org/apache/bookkeeper/clients/grpc/GrpcClientTestBase.java
 
b/stream/clients/java/base/src/test/java/org/apache/bookkeeper/clients/grpc/GrpcClientTestBase.java
index f90a9aa..de51694 100644
--- 
a/stream/clients/java/base/src/test/java/org/apache/bookkeeper/clients/grpc/GrpcClientTestBase.java
+++ 
b/stream/clients/java/base/src/test/java/org/apache/bookkeeper/clients/grpc/GrpcClientTestBase.java
@@ -61,7 +61,7 @@ public abstract class GrpcClientTestBase {
 
     @Before
     public void setUp() throws Exception {
-        serverName = "fake-server";
+        serverName = "fake-server:4181";
         fakeServer = InProcessServerBuilder
             .forName(serverName)
             .fallbackHandlerRegistry(serviceRegistry)

Reply via email to