lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject [1/2] lucene-solr:master: SOLR-9363: tweak test to work around SOLR-9366 + SOLR-9367 since those issues are not key to what's being tested here
Date Tue, 02 Aug 2016 16:01:46 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 77409fd43 -> c17605b4a
  refs/heads/master c60cd2529 -> 04321c401


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


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/04321c40
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/04321c40
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/04321c40

Branch: refs/heads/master
Commit: 04321c401c6584395c76c509f8513c5e5e4730ee
Parents: c60cd25
Author: Chris Hostetter <hossman@apache.org>
Authored: Tue Aug 2 08:50:13 2016 -0700
Committer: Chris Hostetter <hossman@apache.org>
Committed: Tue Aug 2 08:50:13 2016 -0700

----------------------------------------------------------------------
 .../TestStressCloudBlindAtomicUpdates.java      | 23 ++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/04321c40/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
index 80bb98a..637f756 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestStressCloudBlindAtomicUpdates.java
@@ -97,6 +97,14 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase
{
    * larger index is used (so tested docs are more likeely to be spread out in multiple segments)
    */
   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
   private static void createMiniSolrCloudCluster() throws Exception {
@@ -161,9 +169,17 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase
{
     assertEquals(0, CLOUD_CLIENT.optimize().getStatus());
 
     TestInjection.reset();
-
+    
     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);
     TestInjection.failReplicaRequests = testInjection;
     TestInjection.updateLogReplayRandomPause = testInjection;
@@ -249,10 +265,13 @@ public class TestStressCloudBlindAtomicUpdates extends SolrCloudTestCase
{
     
     
     // sanity check index contents
+    waitForRecoveriesToFinish(CLOUD_CLIENT);
     assertEquals(0, CLOUD_CLIENT.commit().getStatus());
     assertEquals(numDocsInIndex,
                  CLOUD_CLIENT.query(params("q", "*:*")).getResults().getNumFound());
 
+    startTestInjection();
+    
     // spin up parallel workers to hammer updates
     List<Future<Worker>> results = new ArrayList<Future<Worker>>(NUM_THREADS);
     for (int workerId = 0; workerId < NUM_THREADS; workerId++) {


Mime
View raw message