You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@helix.apache.org by ka...@apache.org on 2014/10/22 05:20:07 UTC
git commit: Add integration tests to verify that dropping a partition
from resource ideal-state should bring partition to initial state and then
DROPPED state (for AUTO, SEMI_AUTO, and CUSTOM modes)
Repository: helix
Updated Branches:
refs/heads/master cfacbbac3 -> db2127a72
Add integration tests to verify that dropping a partition from resource ideal-state should bring partition to initial state and then DROPPED state (for AUTO, SEMI_AUTO, and CUSTOM modes)
Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/db2127a7
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/db2127a7
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/db2127a7
Branch: refs/heads/master
Commit: db2127a7271faa902ce7f9a988ee95d515ab9062
Parents: cfacbba
Author: Lei Xia <lx...@linkedin.com>
Authored: Tue Oct 21 15:53:57 2014 -0700
Committer: Lei Xia <lx...@linkedin.com>
Committed: Tue Oct 21 15:53:57 2014 -0700
----------------------------------------------------------------------
.../org/apache/helix/integration/TestDrop.java | 33 ++++++++++++++------
1 file changed, 24 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/helix/blob/db2127a7/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java
----------------------------------------------------------------------
diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java b/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java
index 63b5666..7cfd227 100644
--- a/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java
+++ b/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java
@@ -19,6 +19,7 @@ package org.apache.helix.integration;
* under the License.
*/
+import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -45,6 +46,7 @@ import org.apache.helix.tools.ClusterSetup;
import org.apache.helix.tools.ClusterStateVerifier;
import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;
import org.testng.Assert;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class TestDrop extends ZkTestBase {
@@ -462,14 +464,27 @@ public class TestDrop extends ZkTestBase {
System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis()));
}
- /**
- * Drop a single partition in a resource of semi-auto mode
- */
- @Test
- public void testDropSinglePartitionSemiAuto() throws Exception {
- String className = TestHelper.getTestClassName();
- String methodName = TestHelper.getTestMethodName();
- String clusterName = className + "_" + methodName;
+ @DataProvider(name = "RebalanceModeProvider")
+ public static Object [][] rebalanceModes() {
+ IdealState.RebalanceMode modes [] = IdealState.RebalanceMode.values();
+ Object [][] args = new Object[modes.length][];
+ for (int i = 0; i < modes.length; i++) {
+ args[i] = new Object [] { modes[i] };
+ }
+ return args;
+ }
+
+
+ @Test(dataProvider = "RebalanceModeProvider")
+ public void testDropSinglePartition(IdealState.RebalanceMode mode)
+ throws Exception {
+ if (!mode.equals(IdealState.RebalanceMode.FULL_AUTO) &&
+ !mode.equals(IdealState.RebalanceMode.SEMI_AUTO) &&
+ !mode.equals(IdealState.RebalanceMode.CUSTOMIZED)) {
+ return;
+ }
+
+ String clusterName = TestHelper.getTestClassName() + "_" + TestHelper.getTestMethodName() + "_" + mode.name();
int n = 2;
System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis()));
@@ -481,7 +496,7 @@ public class TestDrop extends ZkTestBase {
4, // partitions per resource
n, // number of nodes
2, // replicas
- "MasterSlave", true); // do rebalance
+ "MasterSlave", mode, true); // do rebalance
ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, _baseAccessor);
PropertyKey.Builder keyBuilder = accessor.keyBuilder();