SOLR-7062 testcase to reproduce the bug. Looks like it is not reproducible

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1683466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2015-06-04 06:06:55 +00:00
parent 307c31e695
commit ffc5f8d3e1
1 changed files with 35 additions and 0 deletions

View File

@ -170,6 +170,7 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
@ShardsFixed(num = 4)
public void test() throws Exception {
testNodesUsedByCreate();
testNoConfigSetExist();
testCollectionsAPI();
testCollectionsAPIAddRemoveStress();
testErrorHandling();
@ -497,6 +498,40 @@ public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBa
assertTrue(cloudClient.getZkStateReader().getClusterState().hasCollection("corewithnocollection2"));
}
private void testNoConfigSetExist() throws Exception {
cloudClient.getZkStateReader().updateClusterState(true);
assertFalse(cloudClient.getZkStateReader().getClusterState().hasCollection("corewithnocollection3"));
// try and create a SolrCore with no collection name
Create createCmd = new Create();
createCmd.setCoreName("corewithnocollection3");
createCmd.setCollection("");
String dataDir = createTempDir().toFile().getAbsolutePath();
createCmd.setDataDir(dataDir);
createCmd.setNumShards(1);
createCmd.setCollectionConfigName("conf123");
boolean gotExp = false;
try {
makeRequest(getBaseUrl((HttpSolrClient) clients.get(1)), createCmd);
} catch (SolrException e) {
gotExp = true;
}
assertTrue(gotExp);
TimeUnit.MILLISECONDS.sleep(200);
// in both cases, the collection should have default to the core name
cloudClient.getZkStateReader().updateClusterState(true);
Collection<Slice> slices = cloudClient.getZkStateReader().getClusterState().getActiveSlices("corewithnocollection3");
assertNull(slices);
CollectionAdminRequest.List list = new CollectionAdminRequest.List();
CollectionAdminResponse res = new CollectionAdminResponse();
res.setResponse(makeRequest(getBaseUrl((HttpSolrClient) clients.get(1)), list));
List<String> collections = (List<String>) res.getResponse().get("collections");
assertFalse(collections.contains("corewithnocollection3"));
}
private void testNodesUsedByCreate() throws Exception {
// we can use this client because we just want base url
final String baseUrl = getBaseUrl((HttpSolrClient) clients.get(0));