mirror of https://github.com/apache/lucene.git
SOLR-6482: Omitted tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1625441 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2eb01e7a97
commit
c004edbb7a
|
@ -35,6 +35,7 @@ import org.apache.solr.client.solrj.impl.HttpSolrServer;
|
|||
import org.apache.solr.client.solrj.request.CoreAdminRequest;
|
||||
import org.apache.solr.client.solrj.request.QueryRequest;
|
||||
import org.apache.solr.client.solrj.response.CoreAdminResponse;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.cloud.DocCollection;
|
||||
import org.apache.solr.common.cloud.Replica;
|
||||
import org.apache.solr.common.cloud.Slice;
|
||||
|
@ -119,6 +120,19 @@ public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
|
|||
} finally {
|
||||
replica1Server.shutdown();
|
||||
}
|
||||
try {
|
||||
// Should not be able to delete a replica that is up if onlyIfDown=true.
|
||||
tryToRemoveOnlyIfDown(collectionName, client, replica1, shard1.getName(), dataDir);
|
||||
fail("Should have thrown an exception here because the replica is NOT down");
|
||||
} catch (SolrException se) {
|
||||
assertEquals("Should see 400 here ", se.code(), 400);
|
||||
assertTrue("Should have had a good message here", se.getMessage().contains("with onlyIfDown='true', but state is 'active'"));
|
||||
// This bit is a little weak in that if we're screwing up and actually deleting the replica, we might get back
|
||||
// here _before_ the datadir is deleted. But I'd rather not introduce a delay here.
|
||||
assertTrue("dataDir for " + replica1.getName() + " should NOT have been deleted by deleteReplica API with onlyIfDown='true'",
|
||||
new File(dataDir).exists());
|
||||
}
|
||||
|
||||
|
||||
removeAndWaitForReplicaGone(collectionName, client, replica1,
|
||||
shard1.getName());
|
||||
|
@ -128,6 +142,18 @@ public class DeleteReplicaTest extends AbstractFullDistribZkTestBase {
|
|||
}
|
||||
}
|
||||
|
||||
protected void tryToRemoveOnlyIfDown(String collectionName, CloudSolrServer client, Replica replica, String shard, String dataDir) throws IOException, SolrServerException {
|
||||
Map m = makeMap("collection", collectionName,
|
||||
"action", DELETEREPLICA,
|
||||
"shard", shard,
|
||||
"replica", replica.getName(),
|
||||
ZkStateReader.ONLY_IF_DOWN, "true");
|
||||
SolrParams params = new MapSolrParams(m);
|
||||
SolrRequest request = new QueryRequest(params);
|
||||
request.setPath("/admin/collections");
|
||||
NamedList<Object> resp = client.request(request);
|
||||
}
|
||||
|
||||
protected void removeAndWaitForReplicaGone(String COLL_NAME,
|
||||
CloudSolrServer client, Replica replica, String shard)
|
||||
throws SolrServerException, IOException, InterruptedException {
|
||||
|
|
|
@ -217,7 +217,7 @@ public class TestMiniSolrCloudCluster extends LuceneTestCase {
|
|||
zkClient.makePath(ZkController.CONFIGS_ZKNODE + "/" + configName + "/" + nameInZk, file, false, true);
|
||||
}
|
||||
|
||||
protected NamedList<Object> createCollection(CloudSolrServer server, String name, int numShards,
|
||||
protected NamedList<Object> createCollection(CloudSolrServer server, String name, int numShards,
|
||||
int replicationFactor, String configName) throws Exception {
|
||||
ModifiableSolrParams modParams = new ModifiableSolrParams();
|
||||
modParams.set(CoreAdminParams.ACTION, CollectionAction.CREATE.name());
|
||||
|
|
Loading…
Reference in New Issue