HBASE-12367 Integration tests should not restore the cluster if the CM is not destructive

This commit is contained in:
Enis Soztutar 2014-10-28 17:10:50 -07:00
parent 64b6109ce9
commit 42ed215c2d
4 changed files with 20 additions and 0 deletions

View File

@ -178,6 +178,9 @@ public abstract class IntegrationTestBase extends AbstractHBaseTool {
public abstract void setUpCluster() throws Exception;
public void cleanUpCluster() throws Exception {
if (util.isDistributedCluster() && (monkey == null || !monkey.isDestructive())) {
noClusterCleanUp = true;
}
if (noClusterCleanUp) {
LOG.debug("noClusterCleanUp is set, skip restoring the cluster");
return;

View File

@ -41,4 +41,9 @@ public class CalmChaosMonkey extends ChaosMonkey {
public void waitForStop() throws InterruptedException {
}
@Override
public boolean isDestructive() {
return false;
}
}

View File

@ -51,4 +51,10 @@ public abstract class ChaosMonkey implements Stoppable {
public abstract boolean isStopped();
public abstract void waitForStop() throws InterruptedException;
/**
* Returns whether the CM does destructive actions (killing servers) so that a cluster restore
* is needed after CM is stopped. Otherwise cluster will be left as it is
*/
public abstract boolean isDestructive();
}

View File

@ -149,4 +149,10 @@ public class PolicyBasedChaosMonkey extends ChaosMonkey {
monkeyThread.join();
}
}
@Override
public boolean isDestructive() {
// TODO: we can look at the actions, and decide to do the restore cluster or not based on them.
return true;
}
}