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