You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2019/04/03 22:15:20 UTC

[lucene-solr] branch master updated: Fix test to use solr.disable.shardsWhitelist=true rather then trying to whitelist the set of servers

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3fe4d0a  Fix test to use solr.disable.shardsWhitelist=true rather then trying to whitelist the set of servers
3fe4d0a is described below

commit 3fe4d0a30aab2fbe979c5d42014ac7d78260d0a4
Author: Chris Hostetter <ho...@apache.org>
AuthorDate: Wed Apr 3 15:15:03 2019 -0700

    Fix test to use solr.disable.shardsWhitelist=true rather then trying to whitelist the set of servers
    
    The previous version of this test had a chicken/egg problem (needed to init the servers w/the whitelist but didn't know the port nums until after init)
    
    that caused it to require 'restarting' the servers -- leading to the possibility of 'Address already in use' errors from jenkins machines if the OS reclaimed the port between the stop/start of the jetty instance
---
 .../apache/solr/search/facet/TestJsonFacets.java   | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
index 460a936..b70c8dd 100644
--- a/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
+++ b/solr/core/src/test/org/apache/solr/search/facet/TestJsonFacets.java
@@ -58,6 +58,7 @@ public class TestJsonFacets extends SolrTestCaseHS {
 
   @BeforeClass
   public static void beforeTests() throws Exception {
+    systemSetPropertySolrDisableShardsWhitelist("true");
     JSONTestUtil.failRepeatedKeys = true;
 
     origTableSize = FacetFieldProcessorByHashDV.MAXIMUM_STARTING_TABLE_SIZE;
@@ -74,35 +75,16 @@ public class TestJsonFacets extends SolrTestCaseHS {
   }
 
   /**
-   * Start all servers for cluster, initialize shards whitelist and then restart
+   * Start all servers for cluster if they don't already exist
    */
   public static void initServers() throws Exception {
     if (servers == null) {
       servers = new SolrInstances(3, "solrconfig-tlog.xml", "schema_latest.xml");
-      // Set the shards whitelist to all shards plus the fake one used for tolerant test
-      System.setProperty(SOLR_TESTS_SHARDS_WHITELIST, servers.getWhitelistString() + ",http://[ff01::114]:33332");
-      systemSetPropertySolrDisableShardsWhitelist("false");
-      restartServers();
     }
   }
 
-  /**
-   * Restart all configured servers, i.e. configuration will be re-read
-   */
-  public static void restartServers() {
-    servers.slist.forEach(s -> {
-      try {
-        s.stop();
-        s.start();
-      } catch (Exception e) {
-        fail("Exception during server restart: " + e.getMessage());
-      }
-    });
-  }
-
   @AfterClass
   public static void afterTests() throws Exception {
-    System.clearProperty(SOLR_TESTS_SHARDS_WHITELIST);
     systemClearPropertySolrDisableShardsWhitelist();
     JSONTestUtil.failRepeatedKeys = false;
     FacetFieldProcessorByHashDV.MAXIMUM_STARTING_TABLE_SIZE=origTableSize;