You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by xy...@apache.org on 2023/05/09 15:26:05 UTC

[helix] branch master updated: Fix the test to handle exception in disconnect() code path. (#2482)

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

xyuanlu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git


The following commit(s) were added to refs/heads/master by this push:
     new 05ac90d3f Fix the test to handle exception in disconnect() code path. (#2482)
05ac90d3f is described below

commit 05ac90d3f17f503fa3c59c3527ee44b083dd6252
Author: Komal Desai <98...@users.noreply.github.com>
AuthorDate: Tue May 9 08:25:59 2023 -0700

    Fix the test to handle exception in disconnect() code path. (#2482)
    
    The testcase issues 'disconnect()' from a thread and in the main-thread
    waits for the status to get updated. It is possible that in disconnect() code
    path, there can be an exception and we never get to setting the status.
    Next Assert() is in place to see if we actually disconnected or not.
    
    So at least pass the first Assert() as it is created by test logic and
    not actual code logic.
    
    Co-authored-by: Komal Desai <kd...@kdesai-mn1.linkedin.biz>
---
 .../java/org/apache/helix/integration/TestZkConnectionLost.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
index 9dbdcfb9f..b42752937 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java
@@ -123,8 +123,11 @@ public class TestZkConnectionLost extends TaskTestBase {
     Thread testThread = new Thread("Testing HelixManager disconnect") {
       @Override
       public void run() {
-        controllerManager.disconnect();
-        disconnected.set(true);
+        try {
+          controllerManager.disconnect();
+        } finally {
+          disconnected.set(true);
+        }
       }
     };
     try {