mirror of https://github.com/apache/lucene.git
SOLR-13075: Harden SaslZkACLProviderTest (Kevin Risden, Hrishikesh Gadre, Peter Cseh)
Signed-off-by: Kevin Risden <krisden@apache.org>
This commit is contained in:
parent
ec1d13a372
commit
6596ed1c16
|
@ -57,11 +57,13 @@ public class SaslZkACLProviderTest extends SolrTestCaseJ4 {
|
|||
assumeFalse("FIXME: SOLR-7040: This test fails under IBM J9",
|
||||
Constants.JAVA_VENDOR.startsWith("IBM"));
|
||||
System.setProperty("solrcloud.skip.autorecovery", "true");
|
||||
System.setProperty("hostName", "localhost");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws InterruptedException {
|
||||
public static void afterClass() {
|
||||
System.clearProperty("solrcloud.skip.autorecovery");
|
||||
System.clearProperty("hostName");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,11 +80,8 @@ public class SaslZkACLProviderTest extends SolrTestCaseJ4 {
|
|||
|
||||
System.setProperty("zkHost", zkServer.getZkAddress());
|
||||
|
||||
SolrZkClient zkClient = new SolrZkClientWithACLs(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT);
|
||||
try {
|
||||
try (SolrZkClient zkClient = new SolrZkClientWithACLs(zkServer.getZkHost(), AbstractZkTestCase.TIMEOUT)) {
|
||||
zkClient.makePath("/solr", false, true);
|
||||
} finally {
|
||||
zkClient.close();
|
||||
}
|
||||
setupZNodes();
|
||||
|
||||
|
@ -110,6 +109,7 @@ public class SaslZkACLProviderTest extends SolrTestCaseJ4 {
|
|||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
System.clearProperty("zkHost");
|
||||
zkServer.shutdown();
|
||||
super.tearDown();
|
||||
}
|
||||
|
|
|
@ -456,7 +456,8 @@ public class ZkTestServer {
|
|||
}
|
||||
|
||||
public String getZkHost() {
|
||||
return "127.0.0.1:" + zkServer.getLocalPort();
|
||||
String hostName = System.getProperty("hostName", "127.0.0.1");
|
||||
return hostName + ":" + zkServer.getLocalPort();
|
||||
}
|
||||
|
||||
public String getZkAddress() {
|
||||
|
@ -469,9 +470,10 @@ public class ZkTestServer {
|
|||
* @return the connection string
|
||||
*/
|
||||
public String getZkAddress(String chroot) {
|
||||
if (!chroot.startsWith("/"))
|
||||
if (!chroot.startsWith("/")) {
|
||||
chroot = "/" + chroot;
|
||||
return "127.0.0.1:" + zkServer.getLocalPort() + chroot;
|
||||
}
|
||||
return getZkHost() + chroot;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue