Repository: hbase Updated Branches: refs/heads/master 98deb39ac -> 84ed7cf64
HBASE-11345 Add an option not to restore cluster after an IT test Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/84ed7cf6 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/84ed7cf6 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/84ed7cf6 Branch: refs/heads/master Commit: 84ed7cf645885a4d008e067f268d41d5c70cc1ca Parents: 98deb39 Author: Jimmy Xiang <[email protected]> Authored: Fri Jun 13 10:30:53 2014 -0700 Committer: Jimmy Xiang <[email protected]> Committed: Fri Jun 13 14:27:18 2014 -0700 ---------------------------------------------------------------------- .../apache/hadoop/hbase/IntegrationTestBase.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/84ed7cf6/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java ---------------------------------------------------------------------- diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java index c1669c2..2637f8b 100644 --- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java +++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestBase.java @@ -34,12 +34,14 @@ import org.junit.Before; * Base class for HBase integration tests that want to use the Chaos Monkey. */ public abstract class IntegrationTestBase extends AbstractHBaseTool { - public static final String LONG_OPT = "monkey"; + public static final String NO_CLUSTER_CLEANUP_LONG_OPT = "noClusterCleanUp"; + public static final String MONKEY_LONG_OPT = "monkey"; private static final Log LOG = LogFactory.getLog(IntegrationTestBase.class); protected IntegrationTestingUtility util; protected ChaosMonkey monkey; protected String monkeyToUse; + protected boolean noClusterCleanUp = false; public IntegrationTestBase() { this(null); @@ -51,13 +53,18 @@ public abstract class IntegrationTestBase extends AbstractHBaseTool { @Override protected void addOptions() { - addOptWithArg("m", LONG_OPT, "Which chaos monkey to run"); + addOptWithArg("m", MONKEY_LONG_OPT, "Which chaos monkey to run"); + addOptNoArg("ncc", NO_CLUSTER_CLEANUP_LONG_OPT, + "Don't clean up the cluster at the end"); } @Override protected void processOptions(CommandLine cmd) { - if (cmd.hasOption(LONG_OPT)) { - monkeyToUse = cmd.getOptionValue(LONG_OPT); + if (cmd.hasOption(MONKEY_LONG_OPT)) { + monkeyToUse = cmd.getOptionValue(MONKEY_LONG_OPT); + } + if (cmd.hasOption(NO_CLUSTER_CLEANUP_LONG_OPT)) { + noClusterCleanUp = true; } } @@ -135,6 +142,10 @@ public abstract class IntegrationTestBase extends AbstractHBaseTool { public abstract void setUpCluster() throws Exception; public void cleanUpCluster() throws Exception { + if (noClusterCleanUp) { + LOG.debug("noClusterCleanUp is set, skip restoring the cluster"); + return; + } LOG.debug("Restoring the cluster"); util.restoreCluster(); LOG.debug("Done restoring the cluster");
