bruno-roustant commented on a change in pull request #2472: URL: https://github.com/apache/lucene-solr/pull/2472#discussion_r603916224
########## File path: solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java ########## @@ -302,6 +305,26 @@ public void doTestHandlerPathUnchanged() throws Exception { assertEquals("/replication", ReplicationHandler.PATH); } + @Test + public void testShardsWhitelist() throws Exception { + // Run another test with shards whitelist enabled and whitelist is empty. + // Expect an exception because the leader URL is not allowed. + systemClearPropertySolrDisableShardsWhitelist(); + SolrException e = expectThrows(SolrException.class, this::doTestDetails); + assertTrue(e.getMessage().contains("is not in the '" + HttpShardHandlerFactory.INIT_SHARDS_WHITELIST + "'")); + + // Set the whitelist to allow the leader URL. + // Expect the same test to pass now. + String propertyName = "solr.tests." + HttpShardHandlerFactory.INIT_SHARDS_WHITELIST; + System.setProperty(propertyName, "127.0.0.1:" + leaderJetty.getLocalPort() Review comment: Good point. I'll replace by JettySolrRunner.getBaseUrl(). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org