Apache Solr open-source search software
tests: improve cm tests
Mark Robert Miller534d8b170eba
diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.javaindex da55de72820..3620b8efe39 100644--- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase {public static Logger log = LoggerFactory.getLogger(ChaosMonkeyNothingIsSafeTest.class);- private static final int BASE_RUN_LENGTH = 60000;+ private static final Integer RUN_LENGTH = Integer.parseInt(System.getProperty("solr.tests.cloud.cm.runlength", "-1"));@BeforeClasspublic static void beforeSuperClass() {@@ -138,8 +138,15 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase}chaosMonkey.startTheMonkey(true, 10000);- //int runLength = atLeast(BASE_RUN_LENGTH);- int runLength = BASE_RUN_LENGTH;++ long runLength;+ if (RUN_LENGTH != -1) {+ runLength = RUN_LENGTH;+ } else {+ int[] runTimes = new int[] {5000,6000,10000,15000,15000,30000,30000,45000,90000,120000};+ runLength = runTimes[random().nextInt(runTimes.length - 1)];+ }+try {Thread.sleep(runLength);} finally {@@ -172,7 +179,7 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase// make sure we again have leaders for each shardfor (int j = 1; j < sliceCount; j++) {- zkStateReader.getLeaderRetry(DEFAULT_COLLECTION, "shard" + j, 10000);+ zkStateReader.getLeaderRetry(DEFAULT_COLLECTION, "shard" + j, 30000);}commit();diff --git a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.javaindex 0a5ad55301b..7b498e912da 100644--- a/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java@@ -109,10 +109,11 @@ public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase {int[] runTimes = new int[] {5000,6000,10000,15000,15000,30000,30000,45000,90000,120000};runLength = runTimes[random().nextInt(runTimes.length - 1)];}-- Thread.sleep(runLength);-- chaosMonkey.stopTheMonkey();+ try {+ Thread.sleep(runLength);+ } finally {+ chaosMonkey.stopTheMonkey();+ }for (StopableIndexingThread indexThread : threads) {indexThread.safeStop();