summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-17 16:39:49 +0200
committerGitHub <noreply@github.com>2019-06-17 16:39:49 +0200
commita609b2269a3801edeefd71f92580a92c63c4b79e (patch)
treea79011ff42a22a02a8640c8482dc5200d0afa183
parent5a3bba570e11256d1cca02c3e339a907769da1ee (diff)
parent89cdd94a281ce5c24d48b03dc281452a203f5abf (diff)
Merge pull request #9829 from vespa-engine/vekterli/reduce-zk-session-timeout-in-master-election-unit-tests
Reduce ZK session timeout for master election unit tests
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java
index 23389de3fad..d2fe304a72c 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/MasterElectionTest.java
@@ -39,6 +39,8 @@ public class MasterElectionTest extends FleetControllerTest {
@Rule
public TestRule cleanupZookeeperLogsOnSuccess = new CleanupZookeeperLogsOnSuccess();
+ private static int defaultZkSessionTimeoutInMillis() { return 10_000; }
+
protected void setUpFleetController(int count, boolean useFakeTimer, FleetControllerOptions options) throws Exception {
if (zooKeeperServer == null) {
zooKeeperServer = new ZooKeeperTestServer();
@@ -46,7 +48,7 @@ public class MasterElectionTest extends FleetControllerTest {
slobrok = new Slobrok();
usingFakeTimer = useFakeTimer;
this.options = options;
- this.options.zooKeeperSessionTimeout = 10 * timeoutMS;
+ this.options.zooKeeperSessionTimeout = defaultZkSessionTimeoutInMillis();
this.options.zooKeeperServerAddress = zooKeeperServer.getAddress();
this.options.slobrokConnectionSpecs = new String[1];
this.options.slobrokConnectionSpecs[0] = "tcp/localhost:" + slobrok.port();
@@ -62,7 +64,7 @@ public class MasterElectionTest extends FleetControllerTest {
int fleetControllerIndex, int fleetControllerCount) throws Exception
{
FleetControllerOptions options = o.clone();
- options.zooKeeperSessionTimeout = 10 * timeoutMS;
+ options.zooKeeperSessionTimeout = defaultZkSessionTimeoutInMillis();
options.zooKeeperServerAddress = zooKeeperServer.getAddress();
options.slobrokConnectionSpecs = new String[1];
options.slobrokConnectionSpecs[0] = "tcp/localhost:" + slobrok.port(); // Spec.fromLocalHostName(slobrok.port()).toString();
@@ -251,7 +253,6 @@ public class MasterElectionTest extends FleetControllerTest {
FleetControllerOptions options = defaultOptions("mycluster");
// "Magic" port value is in range allocated to module for testing.
zooKeeperServer = ZooKeeperTestServer.createWithFixedPort(18342);
- options.zooKeeperSessionTimeout = 100;
options.masterZooKeeperCooldownPeriod = 100;
setUpFleetController(2, true, options);
waitForMaster(0);
@@ -273,7 +274,6 @@ public class MasterElectionTest extends FleetControllerTest {
public void testZooKeeperUnavailable() throws Exception {
startingTest("MasterElectionTest::testZooKeeperUnavailable");
FleetControllerOptions options = defaultOptions("mycluster");
- options.zooKeeperSessionTimeout = 100;
options.masterZooKeeperCooldownPeriod = 100;
options.zooKeeperServerAddress = "localhost";
setUpFleetController(5, true, options);