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 2020/04/08 22:53:47 UTC

[helix] 17/50: Fix tests in apache/zooscalability and rebase from apache/master (#787)

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

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

commit 11dc0f38b612065fe60752f61020d494d8663472
Author: Hunter Lee <hu...@linkedin.com>
AuthorDate: Thu Feb 20 13:52:28 2020 -0800

    Fix tests in apache/zooscalability and rebase from apache/master (#787)
    
    There are some failing tests due to environment issues. This PR fixes them by enforcing a deterministic order among tests.
    This PR also rebases apache/zooscalability from apache/master.
---
 .../accessor/TestZkRoutingDataWriter.java          |  1 +
 .../server/TestMetadataStoreDirectoryAccessor.java | 22 +++++++++++-----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataWriter.java b/helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataWriter.java
index 8b7224c..1aba067 100644
--- a/helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataWriter.java
+++ b/helix-rest/src/test/java/org/apache/helix/rest/metadatastore/accessor/TestZkRoutingDataWriter.java
@@ -42,6 +42,7 @@ public class TestZkRoutingDataWriter extends AbstractTestClass {
 
   @BeforeClass
   public void beforeClass() {
+    _baseAccessor.remove(MetadataStoreRoutingConstants.ROUTING_DATA_PATH, AccessOption.PERSISTENT);
     _zkRoutingDataWriter = new ZkRoutingDataWriter(DUMMY_NAMESPACE, ZK_ADDR);
   }
 
diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestMetadataStoreDirectoryAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestMetadataStoreDirectoryAccessor.java
index 02b3915..27e2b10 100644
--- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestMetadataStoreDirectoryAccessor.java
+++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestMetadataStoreDirectoryAccessor.java
@@ -110,6 +110,13 @@ public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
     _metadataStoreDirectory = new ZkMetadataStoreDirectory(routingZkAddrMap);
   }
 
+  @AfterClass
+  public void afterClass()
+      throws Exception {
+    _metadataStoreDirectory.close();
+    deleteRoutingDataPath();
+  }
+
   @Test
   public void testGetAllMetadataStoreRealms()
       throws IOException {
@@ -133,7 +140,7 @@ public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
     Assert.assertEquals(queriedRealmsSet, expectedRealms);
   }
 
-  @Test
+  @Test(dependsOnMethods = "testGetAllMetadataStoreRealms")
   public void testAddMetadataStoreRealm() {
     Collection<String> previousRealms =
         _metadataStoreDirectory.getAllMetadataStoreRealms(TEST_NAMESPACE);
@@ -189,7 +196,7 @@ public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
   /*
    * Tests REST endpoints: "/sharding-keys"
    */
-  @Test
+  @Test(dependsOnMethods = "testDeleteMetadataStoreRealm")
   public void testGetShardingKeysInNamespace()
       throws IOException {
     get(NON_EXISTING_NAMESPACE_URI_PREFIX + "sharding-keys", null,
@@ -218,7 +225,7 @@ public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
   /*
    * Tests REST endpoint: "/sharding-keys?realm={realmName}"
    */
-  @Test
+  @Test(dependsOnMethods = "testGetShardingKeysInNamespace")
   public void testGetShardingKeysInRealm()
       throws IOException {
     // Test NOT_FOUND response for a non existed realm.
@@ -255,7 +262,7 @@ public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
     Assert.assertEquals(queriedShardingKeys, expectedShardingKeys);
   }
 
-  @Test
+  @Test(dependsOnMethods = "testGetShardingKeysInRealm")
   public void testAddShardingKey() {
     Set<String> expectedShardingKeysSet = new HashSet<>(
         _metadataStoreDirectory.getAllShardingKeysInRealm(TEST_NAMESPACE, TEST_REALM_1));
@@ -303,13 +310,6 @@ public class TestMetadataStoreDirectoryAccessor extends AbstractTestClass {
 //    Assert.assertEquals(updatedShardingKeysSet, expectedShardingKeysSet);
   }
 
-  @AfterClass
-  public void afterClass()
-      throws Exception {
-    _metadataStoreDirectory.close();
-    deleteRoutingDataPath();
-  }
-
   private void deleteRoutingDataPath()
       throws Exception {
     Assert.assertTrue(TestHelper.verify(() -> {