Apache Lucene open-source search software
SOLR-7062 testcase to reproduce the bug. Looks like it is not reproducible
Noble Paulffc5f8d3e1bf
diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.javaindex 61d4dc5c74a..e38bb9860be 100644--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java@@ -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 AbstractFullDistribZkTestBaassertTrue(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 urlfinal String baseUrl = getBaseUrl((HttpSolrClient) clients.get(0));