aboutsummaryrefslogtreecommitdiffstats
path: root/zkfacade
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2021-02-04 16:58:39 +0100
committerHarald Musum <musum@verizonmedia.com>2021-03-03 14:18:16 +0100
commitbb8c2e9c3622720de30c2c75ef606cec94729628 (patch)
tree2d40bd16ca8ee6811da7b373bda4c676535686f8 /zkfacade
parent2d5116489de2695acfe7bd7928e65f369ce068f5 (diff)
Simplify, testing server is not used
Diffstat (limited to 'zkfacade')
-rw-r--r--zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java66
1 files changed, 7 insertions, 59 deletions
diff --git a/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java b/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java
index 5341efaefe5..96619258ed3 100644
--- a/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java
+++ b/zkfacade/src/test/java/com/yahoo/vespa/curator/CuratorTest.java
@@ -1,55 +1,27 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.curator;
import com.yahoo.cloud.config.CuratorConfig;
import com.yahoo.net.HostName;
-import org.apache.curator.test.TestingServer;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
-import java.io.IOException;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
/**
- * Sets up actual ZooKeeper servers and verifies we can talk to them.
+ * Very simple testing of setting up curator
*
* @author Ulf Lilleengen
*/
public class CuratorTest {
- private static String localhost = HostName.getLocalhost();
+ private static final String localhost = HostName.getLocalhost();
- private String spec1;
- private String spec2;
- private TestingServer test1;
- private TestingServer test2;
- private int port1;
- private int port2;
-
- @Before
- public void setupServers() throws Exception {
- port1 = allocatePort();
- port2 = allocatePort();
- test1 = new TestingServer(port1);
- test2 = new TestingServer(port2);
- spec1 = localhost + ":" + port1;
- spec2 = localhost + ":" + port2;
- }
-
- private int allocatePort() {
- return PortAllocator.findAvailablePort();
- }
-
- @After
- public void teardownServers() throws IOException {
- test1.stop();
- test1.close();
- test2.close();
- test2.stop();
- }
+ private static final int port1 = 1;
+ private static final int port2 = 2;
+ private static final String spec1 = localhost + ":" + port1;
+ private static final String spec2 = localhost + ":" + port2;
@Test
public void require_curator_is_created_from_config() {
@@ -90,28 +62,4 @@ public class CuratorTest {
Optional.empty());
}
- private static class PortAllocator {
-
- private static class PortRange {
- private int first = 18621;
- private int last = 18630; // see: factory/doc/port-ranges
- private int value = first;
-
- synchronized int next() {
- if (value > last) {
- throw new RuntimeException("no port ports in range");
- }
- return value++;
- }
- }
-
- private final static PortRange portRange = new PortRange();
-
- // Get the next port from a pre-allocated range
- static int findAvailablePort() {
- return portRange.next();
- }
-
- }
-
}