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

This commit is contained in:
Erick Erickson 2018-01-13 11:16:51 -08:00
parent fe86ab982d
commit c110472eaa
3 changed files with 12 additions and 13 deletions

View File

@ -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

View File

@ -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
----------------------

View File

@ -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);
}