You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2014/09/17 02:49:55 UTC
svn commit: r1625441 - in
/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud:
DeleteReplicaTest.java TestMiniSolrCloudCluster.java
Author: erick
Date: Wed Sep 17 00:49:55 2014
New Revision: 1625441
URL: http://svn.apache.org/r1625441
Log:
SOLR-6482: Omitted tests
Modified:
lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java?rev=1625441&r1=1625440&r2=1625441&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java Wed Sep 17 00:49:55 2014
@@ -35,6 +35,7 @@ import org.apache.solr.client.solrj.impl
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 A
} 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 A
}
}
+ 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 {
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java?rev=1625441&r1=1625440&r2=1625441&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudCluster.java Wed Sep 17 00:49:55 2014
@@ -217,7 +217,7 @@ public class TestMiniSolrCloudCluster ex
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());