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);
|
indexDocs(collectionName);
|
||||||
|
|
||||||
if (!isImplicit && random().nextBoolean()) {
|
if (!isImplicit && random().nextBoolean()) {
|
||||||
|
@ -95,14 +97,14 @@ public class TestCloudBackupRestore extends SolrCloudTestCase {
|
||||||
int prevActiveSliceCount = getActiveSliceCount(collectionName);
|
int prevActiveSliceCount = getActiveSliceCount(collectionName);
|
||||||
CollectionAdminRequest.SplitShard splitShard = CollectionAdminRequest.splitShard(collectionName);
|
CollectionAdminRequest.SplitShard splitShard = CollectionAdminRequest.splitShard(collectionName);
|
||||||
splitShard.setShardName("shard1");
|
splitShard.setShardName("shard1");
|
||||||
splitShard.process(cluster.getSolrClient());
|
splitShard.process(solrClient);
|
||||||
// wait until we see one more active slice...
|
// wait until we see one more active slice...
|
||||||
for (int i = 0; getActiveSliceCount(collectionName) != prevActiveSliceCount + 1; i++) {
|
for (int i = 0; getActiveSliceCount(collectionName) != prevActiveSliceCount + 1; i++) {
|
||||||
assertTrue(i < 30);
|
assertTrue(i < 30);
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
}
|
}
|
||||||
// issue a hard commit. Split shard does a soft commit which isn't good enough for the backup/snapshooter to see
|
// 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);
|
testBackupAndRestore(collectionName);
|
||||||
|
@ -120,7 +122,6 @@ public class TestCloudBackupRestore extends SolrCloudTestCase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CloudSolrClient client = cluster.getSolrClient();
|
CloudSolrClient client = cluster.getSolrClient();
|
||||||
client.setDefaultCollection(collectionName);
|
|
||||||
List<SolrInputDocument> docs = new ArrayList<>(numDocs);
|
List<SolrInputDocument> docs = new ArrayList<>(numDocs);
|
||||||
for (int i=0; i<numDocs; i++) {
|
for (int i=0; i<numDocs; i++) {
|
||||||
SolrInputDocument doc = new SolrInputDocument();
|
SolrInputDocument doc = new SolrInputDocument();
|
||||||
|
@ -129,7 +130,7 @@ public class TestCloudBackupRestore extends SolrCloudTestCase {
|
||||||
docs.add(doc);
|
docs.add(doc);
|
||||||
}
|
}
|
||||||
client.add(docs);// batch
|
client.add(docs);// batch
|
||||||
client.commit();
|
client.commit(collectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testBackupAndRestore(String collectionName) throws Exception {
|
private void testBackupAndRestore(String collectionName) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue