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) CollectionAdminRequest.createCollection(COLLECTION, 1, 4)
.setMaxShardsPerNode(1000) .setMaxShardsPerNode(1000)
.process(cluster.getSolrClient()); .process(cluster.getSolrClient());
cluster.waitForActiveCollection(COLLECTION, 1, 4);
} }
@Test @Test
@ -75,7 +76,7 @@ public class AssignBackwardCompatibilityTest extends SolrCloudTestCase {
clearedCounter = true; clearedCounter = true;
} }
if (deleteReplica) { if (deleteReplica) {
waitForState("Expected " + numLiveReplicas + " active replicas", COLLECTION, clusterShape(1, numLiveReplicas)); cluster.waitForActiveCollection(COLLECTION, 1, numLiveReplicas);
DocCollection dc = getCollectionState(COLLECTION); DocCollection dc = getCollectionState(COLLECTION);
Replica replica = getRandomReplica(dc.getSlice("shard1"), (r) -> r.getState() == Replica.State.ACTIVE); Replica replica = getRandomReplica(dc.getSlice("shard1"), (r) -> r.getState() == Replica.State.ACTIVE);
CollectionAdminRequest.deleteReplica(COLLECTION, "shard1", replica.getName()).process(cluster.getSolrClient()); 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)); assertFalse("Core name is not unique coreName=" + coreName + " " + coreNames, coreNames.contains(coreName));
coreNames.add(coreName); coreNames.add(coreName);
numLiveReplicas++; numLiveReplicas++;
waitForState("Expected " + numLiveReplicas + " active replicas", COLLECTION, clusterShape(1, numLiveReplicas)); cluster.waitForActiveCollection(COLLECTION, 1, numLiveReplicas);
Replica newReplica = getCollectionState(COLLECTION).getReplicas().stream() Replica newReplica = getCollectionState(COLLECTION).getReplicas().stream()
.filter(r -> r.getCoreName().equals(coreName)) .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()); return newLeader != null && newLeader.getName().equals(leader.getName());
}); });
waitForState("Timeout waiting for active collection", collection, clusterShape(1, 3)); 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 { 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) CollectionAdminRequest.createCollection(collection, CONF_NAME, NUM_SERVERS, 1)
.withProperty("config", "solrconfig-tlog.xml") .withProperty("config", "solrconfig-tlog.xml")
.process(cloudClient); .process(cloudClient);
ZkStateReader zkStateReader = cloudClient.getZkStateReader(); cluster.waitForActiveCollection(collection, NUM_SERVERS, NUM_SERVERS);
AbstractDistribZkTestBase.waitForRecoveriesToFinish(collection, zkStateReader, true, true, 330);
assertEquals("sanity query", 0, cloudClient.query(collection, params("q","*:*")).getStatus()); assertEquals("sanity query", 0, cloudClient.query(collection, params("q","*:*")).getStatus());
} }

View File

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