diff options
author | Martin Polden <mpolden@mpolden.no> | 2018-08-03 14:55:26 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2018-08-03 14:55:26 +0200 |
commit | 82274afc12128527c55f10d55c512bf1e4a0ace6 (patch) | |
tree | 03bc1d57014ddb017828d509bcfe7cc2f5bdf39b /node-repository | |
parent | 3e302a30c1f908c35dfdf5d044be47118e98d70e (diff) |
Avoid scheduled runs during test
Travis build machines are slow enough that a scheduled execution might occur
while tests are running, causing a dead lock.
Diffstat (limited to 'node-repository')
2 files changed, 8 insertions, 4 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java index 368f1fef776..299dc66c547 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/testutils/MockDeployer.java @@ -67,7 +67,11 @@ public class MockDeployer implements Deployer { @Override public Optional<Deployment> deployFromLocalActive(ApplicationId id, Duration timeout) { - lock.lock(); + try { + lock.lockInterruptibly(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } try { lastDeployTimes.put(id, clock.instant()); return Optional.of(new MockDeployment(provisioner, applications.get(id))); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java index 22ce879cac6..ae33a4a3899 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/PeriodicApplicationMaintainerTest.java @@ -171,14 +171,14 @@ public class PeriodicApplicationMaintainerTest { } @Test - public void queues_all_eligible_applications_for_deployment() { + public void queues_all_eligible_applications_for_deployment() throws Exception { fixture.activate(); // Exhaust initial wait period clock.advance(Duration.ofMinutes(30).plus(Duration.ofSeconds(1))); // Lock deployer to simulate slow deployments - fixture.deployer.lock().lock(); + fixture.deployer.lock().lockInterruptibly(); try { // Queues all eligible applications @@ -255,7 +255,7 @@ public class PeriodicApplicationMaintainerTest { apps.put(app2, new MockDeployer.ApplicationContext(app2, clusterApp2, Capacity.fromNodeCount(wantedNodesApp2, Optional.of("default"), false, true), 1)); this.deployer = new MockDeployer(provisioner, nodeRepository.clock(), apps); - this.maintainer = new TestablePeriodicApplicationMaintainer(deployer, nodeRepository, Duration.ofMinutes(1), + this.maintainer = new TestablePeriodicApplicationMaintainer(deployer, nodeRepository, Duration.ofDays(1), // Long duration to prevent scheduled runs during test Duration.ofMinutes(30)); } |