Github user romseygeek commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/37#discussion_r63663755
  
    --- Diff: 
solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java 
---
    @@ -435,73 +278,55 @@ private void testErrorHandling() throws Exception {
         request.setPath("/admin/collections");
         gotExp = false;
         try {
    -      makeRequest(baseUrl, request);
    +      cloudClient.request(request);
         } catch (SolrException e) {
           gotExp = true;
         }
         assertTrue(gotExp);
         
    -    // Too many replicas
    +    // No numShards should fail
         params = new ModifiableSolrParams();
         params.set("action", CollectionAction.CREATE.toString());
    -    collectionName = "collection";
    +    collectionName = "acollection";
         params.set("name", collectionName);
    -    params.set("numShards", 2);
    +    params.set(REPLICATION_FACTOR, 10);
         if (secondConfigSet) {
           params.set("collection.configName", "conf1");
         }
    -    params.set(REPLICATION_FACTOR, 10);
         request = new QueryRequest(params);
         request.setPath("/admin/collections");
         gotExp = false;
         try {
    -      makeRequest(baseUrl, request);
    +      cloudClient.request(request);
         } catch (SolrException e) {
           gotExp = true;
         }
         assertTrue(gotExp);
    +  }
    +  
    +  @Test
    +  public void testBadParams() throws SolrServerException, IOException {
    +    int exceptionCount = 0;
         
    -    // No numShards should fail
    -    params = new ModifiableSolrParams();
    -    params.set("action", CollectionAction.CREATE.toString());
    -    collectionName = "acollection";
    -    params.set("name", collectionName);
    -    params.set(REPLICATION_FACTOR, 10);
    -    if (secondConfigSet) {
    -      params.set("collection.configName", "conf1");
    -    }
    -    request = new QueryRequest(params);
    -    request.setPath("/admin/collections");
    -    gotExp = false;
    +    // Too many replicas
         try {
    -      makeRequest(baseUrl, request);
    +      createCollection("collection", configSet, 2, 
10).process(cloudClient);
         } catch (SolrException e) {
    -      gotExp = true;
    +      ++exceptionCount;
    --- End diff --
    
    Rather than doing this, can you use ```expectThrows()```?  That way we get 
better error messages if the test fails.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to