SOLR-9363: tweak test to work around SOLR-9366 + SOLR-9367 since those issues are not key to what's being tested here

This commit is contained in:
Chris Hostetter 2016-08-02 08:50:13 -07:00
parent c60cd2529b
commit 04321c401c
1 changed files with 21 additions and 2 deletions

View File

@ -98,6 +98,14 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
*/ */
private static int DOC_ID_INCR; private static int DOC_ID_INCR;
/**
* The TestInjection configuration to be used for the current test method.
*
* Value is set by {@link #clearCloudCollection}, and used by {@link #startTestInjection} -- but only once
* initial index seeding has finished (we're focusing on testing atomic updates, not basic indexing).
*/
private String testInjection = null;
@BeforeClass @BeforeClass
private static void createMiniSolrCloudCluster() throws Exception { private static void createMiniSolrCloudCluster() throws Exception {
// NOTE: numDocsToCheck uses atLeast, so nightly & multiplier are alreayd a factor in index size // NOTE: numDocsToCheck uses atLeast, so nightly & multiplier are alreayd a factor in index size
@ -163,7 +171,15 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
TestInjection.reset(); TestInjection.reset();
final int injectionPercentage = (int)Math.ceil(atLeast(1) / 2); final int injectionPercentage = (int)Math.ceil(atLeast(1) / 2);
final String testInjection = usually() ? "false:0" : ("true:" + injectionPercentage); testInjection = usually() ? "false:0" : ("true:" + injectionPercentage);
}
/**
* Assigns {@link #testInjection} to various TestInjection variables. Calling this
* method multiple times in the same method should always result in the same setting being applied
* (even if {@link TestInjection#reset} was called in between.
*/
private void startTestInjection() {
log.info("TestInjection: fail replica, update pause, tlog pauses: " + testInjection); log.info("TestInjection: fail replica, update pause, tlog pauses: " + testInjection);
TestInjection.failReplicaRequests = testInjection; TestInjection.failReplicaRequests = testInjection;
TestInjection.updateLogReplayRandomPause = testInjection; TestInjection.updateLogReplayRandomPause = testInjection;
@ -249,10 +265,13 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase {
// sanity check index contents // sanity check index contents
waitForRecoveriesToFinish(CLOUD_CLIENT);
assertEquals(0, CLOUD_CLIENT.commit().getStatus()); assertEquals(0, CLOUD_CLIENT.commit().getStatus());
assertEquals(numDocsInIndex, assertEquals(numDocsInIndex,
CLOUD_CLIENT.query(params("q", "*:*")).getResults().getNumFound()); CLOUD_CLIENT.query(params("q", "*:*")).getResults().getNumFound());
startTestInjection();
// spin up parallel workers to hammer updates // spin up parallel workers to hammer updates
List<Future<Worker>> results = new ArrayList<Future<Worker>>(NUM_THREADS); List<Future<Worker>> results = new ArrayList<Future<Worker>>(NUM_THREADS);
for (int workerId = 0; workerId < NUM_THREADS; workerId++) { for (int workerId = 0; workerId < NUM_THREADS; workerId++) {