You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2021/02/21 15:05:25 UTC

[lucene-solr] branch reference_impl_dev updated: @1363 Test hardening.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new c786156  @1363 Test hardening.
c786156 is described below

commit c786156c83ed5e656835ecdc82415858792ec9fb
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Sun Feb 21 09:04:51 2021 -0600

    @1363 Test hardening.
    
    Took 9 minutes
---
 .../solr/handler/admin/ShowFileRequestHandlerTest.java       | 12 ++++++------
 .../solr/client/solrj/impl/CloudSolrClientBuilderTest.java   |  4 ++--
 .../solrj/impl/CloudSolrClientMultiConstructorTest.java      |  6 +++---
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java b/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
index f24549c..136bfd5 100644
--- a/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
@@ -54,12 +54,12 @@ public class ShowFileRequestHandlerTest extends SolrJettyTestBase {
   }
 
   public void test404ViaHttp() throws Exception {
-
-    QueryRequest request = new QueryRequest(params("file",
-            "does-not-exist-404.txt"));
-    request.setPath("/admin/file");
-    SolrException e = SolrTestCaseUtil.expectThrows(SolrException.class, () -> request.process(client));
-    assertEquals(e.toString(), 404, e.code());
+    try (SolrClient client = createNewSolrClient(jetty)) {
+      QueryRequest request = new QueryRequest(params("file", "does-not-exist-404.txt"));
+      request.setPath("/admin/file");
+      SolrException e = SolrTestCaseUtil.expectThrows(SolrException.class, () -> request.process(client));
+      assertEquals(e.toString(), 404, e.code());
+    }
   }
 
   public void test404Locally() throws Exception {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java
index 4051b85..3e6b122 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientBuilderTest.java
@@ -33,10 +33,10 @@ public class CloudSolrClientBuilderTest extends SolrTestCase {
   private static final String ANY_OTHER_ZK_HOST = "ANY_OTHER_ZK_HOST";
 
   @Test(expected = IllegalArgumentException.class)
-  public void testNoZkHostSpecified() {
+  public void testNoZkHostSpecified() throws IOException {
     new Builder()
       .withZkChroot(ANY_CHROOT)
-      .build();
+      .build().close();
   }
   
   @Test
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientMultiConstructorTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientMultiConstructorTest.java
index 85b3471..c13b812 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientMultiConstructorTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrClientMultiConstructorTest.java
@@ -44,7 +44,7 @@ public class CloudSolrClientMultiConstructorTest extends SolrTestCase {
 
     final String chroot = "/mychroot";
 
-    StringBuilder sb = new StringBuilder();
+    StringBuilder sb = new StringBuilder(128);
 
     if(setOrList) {
       /*
@@ -102,9 +102,9 @@ public class CloudSolrClientMultiConstructorTest extends SolrTestCase {
   }
   
   @Test(expected = IllegalArgumentException.class)
-  public void testBadChroot() {
+  public void testBadChroot() throws IOException {
     final List<String> zkHosts = new ArrayList<>();
     zkHosts.add("host1:2181");
-    new CloudSolrClient.Builder(zkHosts, Optional.of("foo")).build();
+    new CloudSolrClient.Builder(zkHosts, Optional.of("foo")).build().close();
   }
 }