From b794c458335cc69f973a7402d6965c3064e4495f Mon Sep 17 00:00:00 2001 From: Junkai Xue Date: Tue, 30 Jul 2024 12:49:09 -0700 Subject: [PATCH] Fix unstable test testDisconnectWhenConnectionBreak Make the thread force interrupted and check the state of thread be terminated then start the zk. --- .../org/apache/helix/integration/TestZkConnectionLost.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 d31a69c179..eb1f7b5f69 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 @@ -136,7 +136,9 @@ public void run() { Assert.assertTrue(disconnected.get()); Assert.assertFalse(controllerManager.isConnected()); } finally { - testThread.interrupt(); + testThread.stop(); + TestHelper.verify(() -> testThread.getState().equals(Thread.State.TERMINATED), + TestHelper.WAIT_DURATION); _zkServerRef.set(TestHelper.startZkServer(_zkAddr, null, false)); } }