You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by hu...@apache.org on 2019/05/25 01:20:14 UTC

[helix] 40/44: Fix unstable test for TestZKUtil

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

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

commit df80d269764e13703ea1297c7b98d82ae127fc0f
Author: Junkai Xue <jx...@linkedin.com>
AuthorDate: Fri May 17 17:43:40 2019 -0700

    Fix unstable test for TestZKUtil
    
    Since tests run parallel, it caused race condition for data messed up in ZK. Fix it with different id.
    
    RB=1671516
    
    RB=1671516
    G=helix-reviewers
    A=hulee
    
    Signed-off-by: Hunter Lee <hu...@linkedin.com>
---
 .../test/java/org/apache/helix/manager/zk/TestZKUtil.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
index 2986748..5ccaaf3 100644
--- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
+++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZKUtil.java
@@ -164,20 +164,20 @@ public class TestZKUtil extends ZkUnitTestBase {
 
   @Test()
   public void testCreateOrUpdate() {
-    String path = PropertyPathBuilder.instanceConfig(clusterName, "id7");
-    ZNRecord record = new ZNRecord("id7");
+    String path = PropertyPathBuilder.instanceConfig(clusterName, "id9");
+    ZNRecord record = new ZNRecord("id9");
     ZKUtil.createOrMerge(_gZkClient, path, record, true, true);
     record = _gZkClient.readData(path);
-    AssertJUnit.assertEquals("id7", record.getId());
+    AssertJUnit.assertEquals("id9", record.getId());
 
-    record = new ZNRecord("id7");
+    record = new ZNRecord("id9");
     List<String> list = Arrays.asList("value1", "value2");
     record.setListField("list", list);
     ZKUtil.createOrUpdate(_gZkClient, path, record, true, true);
     record = _gZkClient.readData(path);
     AssertJUnit.assertEquals(list, record.getListField("list"));
 
-    record = new ZNRecord("id7");
+    record = new ZNRecord("id9");
     List<String> list2 = Arrays.asList("value3", "value4");
     record.setListField("list", list2);
     ZKUtil.createOrUpdate(_gZkClient, path, record, true, true);
@@ -191,7 +191,7 @@ public class TestZKUtil extends ZkUnitTestBase {
     record = _gZkClient.readData(path);
     AssertJUnit.assertEquals(map, record.getMapField("map"));
 
-    record = new ZNRecord("id7");
+    record = new ZNRecord("id9");
     Map<String, String> map2 = new HashMap<String, String>() {{put("k2", "v2");}};
     record.setMapField("map", map2);
     ZKUtil.createOrUpdate(_gZkClient, path, record, true, true);