Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][test] Fix running ClusterMetadataSetupTest in IDE #23492

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,9 @@ static class ZookeeperServerTest implements Closeable {
private ZooKeeperServer zks;
private NIOServerCnxnFactory serverFactory;
private final int zkPort;
private final String hostPort;

public ZookeeperServerTest(int zkPort) throws IOException {
this.zkPort = zkPort;
this.hostPort = "127.0.0.1:" + zkPort;
this.zkTmpDir = File.createTempFile("zookeeper", "test");
log.info("**** Start GZK on {} ****", zkTmpDir);
if (!zkTmpDir.delete() || !zkTmpDir.mkdir()) {
Expand All @@ -520,15 +518,17 @@ public ZookeeperServerTest(int zkPort) throws IOException {

public void start() throws IOException {
try {
System.setProperty("zookeeper.4lw.commands.whitelist", "*");
zks = new ZooKeeperServer(zkTmpDir, zkTmpDir, ZooKeeperServer.DEFAULT_TICK_TIME);
zks.setMaxSessionTimeout(20000);
serverFactory = new NIOServerCnxnFactory();
serverFactory.configure(new InetSocketAddress(zkPort), 1000);
serverFactory.configure(new InetSocketAddress("127.0.0.1", zkPort), 1000);
serverFactory.startup(zks);
} catch (Exception e) {
log.error("Exception while instantiating ZooKeeper", e);
}

String hostPort = "127.0.0.1:" + serverFactory.getLocalPort();
LocalBookkeeperEnsemble.waitForServerUp(hostPort, 30000);
log.info("ZooKeeper started at {}", hostPort);
}
Expand Down
Loading