Skip to content

Apache Lucene open-source search software

SOLR-11389: Fix test failures resulting from SOLR-11218

Erick Ericksonc110472eaa97
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 663e733f6b0..f6f4da3d769 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -1309,7 +1309,8 @@ ant test "-Dtests.method=*esi*"
ant test -Dtests.seed=DEADBEEF
# Repeats _all_ tests of ClassName N times. Every test repetition
-# will have a different seed.
+# will have a different seed. NOTE: does not reinitialize
+# between repetitions, use only for idempotent tests.
ant test -Dtests.iters=N -Dtestcase=ClassName
# Repeats _all_ tests of ClassName N times. Every test repetition
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 799637df404..b14d79e0dda 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -99,6 +99,8 @@ Bug Fixes
* SOLR-11631: The Schema API should return non-zero status when there are failures.
(Noble Paul, Steve Rowe)
+* SOLR-11839: Fix test failures resulting from SOLR-11218 (Erick Erickson)
+
Optimizations
----------------------
diff --git a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
index db4b877657c..102377d7687 100644
--- a/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/update/processor/TimeRoutedAliasUpdateProcessorTest.java
@@ -50,7 +50,6 @@ import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.junit.AfterClass;
-import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -77,14 +76,6 @@ public class TimeRoutedAliasUpdateProcessorTest extends SolrCloudTestCase {
IOUtils.close(solrClient);
}
- //TODO this is necessary when -Dtests.iters but why? Some other tests aren't affected
- @Before
- public void doBefore() throws Exception {
- for (String col : CollectionAdminRequest.listCollections(solrClient)) {
- CollectionAdminRequest.deleteCollection(col).process(solrClient);
- }
- }
-
@Test
public void test() throws Exception {
// First create a config using REST API. To do this, we create a collection with the name of the eventual config.
@@ -260,9 +251,14 @@ public class TimeRoutedAliasUpdateProcessorTest extends SolrCloudTestCase {
System.err.println("Docs committed sooner than expected. Bug or slow test env?");
return;
}
- // wait until it's committed, plus some play time for commit to become visible
- Thread.sleep(commitWithin + 200);
- numDocs = queryNumDocs();
+ // wait until it's committed
+ Thread.sleep(commitWithin);
+ for (int idx = 0; idx < 100; ++idx) { // Loop for up to 10 seconds waiting for commit to catch up
+ numDocs = queryNumDocs();
+ if (numDocsBefore + solrInputDocuments.length == numDocs) break;
+ Thread.sleep(100);
+ }
+
assertEquals("not committed. Bug or a slow test?",
numDocsBefore + solrInputDocuments.length, numDocs);
}