mirror of https://github.com/apache/lucene.git
SOLR-5750: Fix test to specify the collection on commit
This commit is contained in:
parent
630a8c950d
commit
0a20dd47d1
|
@ -87,7 +87,9 @@ public class TestCloudBackupRestore extends SolrCloudTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
create.process(cluster.getSolrClient());
|
||||
CloudSolrClient solrClient = cluster.getSolrClient();
|
||||
create.process(solrClient);
|
||||
|
||||
indexDocs(collectionName);
|
||||
|
||||
if (!isImplicit && random().nextBoolean()) {
|
||||
|
@ -95,14 +97,14 @@ public class TestCloudBackupRestore extends SolrCloudTestCase {
|
|||
int prevActiveSliceCount = getActiveSliceCount(collectionName);
|
||||
CollectionAdminRequest.SplitShard splitShard = CollectionAdminRequest.splitShard(collectionName);
|
||||
splitShard.setShardName("shard1");
|
||||
splitShard.process(cluster.getSolrClient());
|
||||
splitShard.process(solrClient);
|
||||
// wait until we see one more active slice...
|
||||
for (int i = 0; getActiveSliceCount(collectionName) != prevActiveSliceCount + 1; i++) {
|
||||
assertTrue(i < 30);
|
||||
Thread.sleep(500);
|
||||
}
|
||||
// issue a hard commit. Split shard does a soft commit which isn't good enough for the backup/snapshooter to see
|
||||
cluster.getSolrClient().commit();
|
||||
solrClient.commit(collectionName);
|
||||
}
|
||||
|
||||
testBackupAndRestore(collectionName);
|
||||
|
@ -120,7 +122,6 @@ public class TestCloudBackupRestore extends SolrCloudTestCase {
|
|||
return;
|
||||
}
|
||||
CloudSolrClient client = cluster.getSolrClient();
|
||||
client.setDefaultCollection(collectionName);
|
||||
List<SolrInputDocument> docs = new ArrayList<>(numDocs);
|
||||
for (int i=0; i<numDocs; i++) {
|
||||
SolrInputDocument doc = new SolrInputDocument();
|
||||
|
@ -129,7 +130,7 @@ public class TestCloudBackupRestore extends SolrCloudTestCase {
|
|||
docs.add(doc);
|
||||
}
|
||||
client.add(docs);// batch
|
||||
client.commit();
|
||||
client.commit(collectionName);
|
||||
}
|
||||
|
||||
private void testBackupAndRestore(String collectionName) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue