This is an automated email from the ASF dual-hosted git repository.
jiajunwang 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 1b3b31c Fix TestZkConnectionLost (#1824)
1b3b31c is described below
commit 1b3b31c752f8a594b12bd950a4f6c3278a63bccf
Author: Neal Sun <[email protected]>
AuthorDate: Tue Aug 3 10:57:12 2021 -0700
Fix TestZkConnectionLost (#1824)
Fix TestZkConnectionLost by adding longer connection timeout and fixing
logic that are incorrect.
Co-authored-by: Neal Sun <[email protected]>
---
.../org/apache/helix/integration/TestZkConnectionLost.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 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 cc7325f..9dbdcfb 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
@@ -40,6 +40,7 @@ import org.apache.helix.integration.task.TaskTestUtil;
import org.apache.helix.integration.task.WorkflowGenerator;
import org.apache.helix.manager.zk.ZKHelixDataAccessor;
import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.manager.zk.ZkBaseDataAccessor;
import org.apache.helix.task.JobConfig;
import org.apache.helix.task.JobQueue;
import org.apache.helix.task.TaskState;
@@ -139,13 +140,14 @@ public class TestZkConnectionLost extends TaskTestBase {
@Test
public void testLostZkConnection() throws Exception {
- System.setProperty(SystemPropertyKeys.ZK_WAIT_CONNECTED_TIMEOUT, "1000");
- System.setProperty(SystemPropertyKeys.ZK_SESSION_TIMEOUT, "1000");
+ System.setProperty(SystemPropertyKeys.ZK_WAIT_CONNECTED_TIMEOUT, "5000");
+ System.setProperty(SystemPropertyKeys.ZK_SESSION_TIMEOUT, "5000");
try {
String queueName = TestHelper.getTestMethodName();
startParticipants(_zkAddr);
- HelixDataAccessor accessor = new ZKHelixDataAccessor(CLUSTER_NAME,
_baseAccessor);
- TestHelper.verify(() -> {
+ HelixDataAccessor accessor =
+ new ZKHelixDataAccessor(CLUSTER_NAME, new
ZkBaseDataAccessor(_zkAddr));
+ Assert.assertTrue(TestHelper.verify(() -> {
List<String> liveInstances =
accessor.getChildNames(accessor.keyBuilder().liveInstances());
for (MockParticipantManager participant : _participants) {
if (!liveInstances.contains(participant.getInstanceName())
@@ -154,7 +156,7 @@ public class TestZkConnectionLost extends TaskTestBase {
}
}
return true;
- }, TestHelper.WAIT_DURATION);
+ }, TestHelper.WAIT_DURATION));
// Create a queue
LOG.info("Starting job-queue: " + queueName);