summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-17 14:35:14 +0200
committerTor Brede Vekterli <vekterli@verizonmedia.com>2019-06-17 14:35:14 +0200
commit89cdd94a281ce5c24d48b03dc281452a203f5abf (patch)
treece081ab762f6dcfd8d1c94d1eeca3fb3813c791c
parentecd979b3a899175a81be23839346392cfe10f6cf (diff)
Reduce ZK session timeout for master election unit tests
Setup methods would previously override explicit timeouts set by the tests with a default of 2 minutes. It's suspected that this long timeout combined with spurious ZK client failures is a source of test failures. Reduce to 10 seconds for now. Let's see how well it fares on a heavily loaded CI container.
-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);