SOLR-12801: use waitForActiveCollection call

This commit is contained in:
markrmiller 2018-12-09 15:51:17 -06:00
parent f6063a1461
commit 0824f7b045
4 changed files with 8 additions and 4 deletions

View File

@ -53,6 +53,7 @@ public class AssignBackwardCompatibilityTest extends SolrCloudTestCase {
CollectionAdminRequest.createCollection(COLLECTION, 1, 4)
.setMaxShardsPerNode(1000)
.process(cluster.getSolrClient());
cluster.waitForActiveCollection(COLLECTION, 1, 4);
}
@Test
@ -75,7 +76,7 @@ public class AssignBackwardCompatibilityTest extends SolrCloudTestCase {
clearedCounter = true;
}
if (deleteReplica) {
waitForState("Expected " + numLiveReplicas + " active replicas", COLLECTION, clusterShape(1, numLiveReplicas));
cluster.waitForActiveCollection(COLLECTION, 1, numLiveReplicas);
DocCollection dc = getCollectionState(COLLECTION);
Replica replica = getRandomReplica(dc.getSlice("shard1"), (r) -> r.getState() == Replica.State.ACTIVE);
CollectionAdminRequest.deleteReplica(COLLECTION, "shard1", replica.getName()).process(cluster.getSolrClient());
@ -90,7 +91,7 @@ public class AssignBackwardCompatibilityTest extends SolrCloudTestCase {
assertFalse("Core name is not unique coreName=" + coreName + " " + coreNames, coreNames.contains(coreName));
coreNames.add(coreName);
numLiveReplicas++;
waitForState("Expected " + numLiveReplicas + " active replicas", COLLECTION, clusterShape(1, numLiveReplicas));
cluster.waitForActiveCollection(COLLECTION, 1, numLiveReplicas);
Replica newReplica = getCollectionState(COLLECTION).getReplicas().stream()
.filter(r -> r.getCoreName().equals(coreName))

View File

@ -229,6 +229,8 @@ public class TestCloudConsistency extends SolrCloudTestCase {
return newLeader != null && newLeader.getName().equals(leader.getName());
});
waitForState("Timeout waiting for active collection", collection, clusterShape(1, 3));
cluster.waitForActiveCollection(collection, 1, 3);
}
private void addDocs(String collection, int numDocs, int startId) throws SolrServerException, IOException {

View File

@ -263,8 +263,7 @@ public class TestMiniSolrCloudClusterSSL extends SolrTestCaseJ4 {
CollectionAdminRequest.createCollection(collection, CONF_NAME, NUM_SERVERS, 1)
.withProperty("config", "solrconfig-tlog.xml")
.process(cloudClient);
ZkStateReader zkStateReader = cloudClient.getZkStateReader();
AbstractDistribZkTestBase.waitForRecoveriesToFinish(collection, zkStateReader, true, true, 330);
cluster.waitForActiveCollection(collection, NUM_SERVERS, NUM_SERVERS);
assertEquals("sanity query", 0, cloudClient.query(collection, params("q","*:*")).getStatus());
}

View File

@ -161,6 +161,8 @@ public class CustomCollectionTest extends SolrCloudTestCase {
.setMaxShardsPerNode(maxShardsPerNode)
.setRouterField(shard_fld)
.process(cluster.getSolrClient());
cluster.waitForActiveCollection(collectionName, numShards, numShards * replicationFactor);
new UpdateRequest()
.add("id", "6", shard_fld, "a")