Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Finally fix TestCoordinatorRole for good. (#3205)

Houston Putman5a8adec0a573
diff --git a/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java b/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java
index cafe7ed0268..d14a98cf0f8 100644
--- a/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java
+++ b/solr/core/src/test/org/apache/solr/search/TestCoordinatorRole.java
@@ -361,11 +361,17 @@ public class TestCoordinatorRole extends SolrCloudTestCase {
// TODO: could separate this out into a different test method, but this should suffice for
// now
pullJetty.start(true);
+ waitForState(
+ "Pull jetty replicas didn't become active in time",
+ COLL,
+ ((liveNodes, collectionState) ->
+ collectionState.getReplicas(pullJettyF.getNodeName()).stream()
+ .allMatch(rep -> rep.getState() == Replica.State.ACTIVE)));
AtomicBoolean done = new AtomicBoolean();
long runMinutes = 1;
long finishTimeMs =
new Date().getTime() + TimeUnit.MILLISECONDS.convert(runMinutes, TimeUnit.MINUTES);
- JettySolrRunner[] jettys = new JettySolrRunner[] {nrtJettyF, pullJettyF};
+ JettySolrRunner[] jettys = new JettySolrRunner[] {pullJettyF, nrtJettyF};
Random threadRandom = new Random(r.nextInt());
Future<Integer> f =
executor.submit(
@@ -386,6 +392,12 @@ public class TestCoordinatorRole extends SolrCloudTestCase {
log.info("restarting {} ...", idx);
toManipulate.start(true);
log.info("restarted {}.", idx);
+ waitForState(
+ toManipulate.getNodeName() + " replicas didn't become active in time",
+ COLL,
+ ((liveNodes, collectionState) ->
+ collectionState.getReplicas(toManipulate.getNodeName()).stream()
+ .allMatch(rep -> rep.getState() == Replica.State.ACTIVE)));
} catch (Exception e) {
throw new RuntimeException(e);
}