From e5e9296d6b5480623e85f6cb601c5228ded62e30 Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Tue, 20 Mar 2018 18:06:31 +0100 Subject: Expand the with next job logic --- .../controller/deployment/DeploymentTriggerTest.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'controller-server') diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java index 2dc90563580..33fb1b39bb7 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java @@ -23,6 +23,7 @@ import org.junit.Test; import java.time.Duration; import java.time.Instant; +import java.util.Collections; import java.util.Optional; import java.util.function.Supplier; @@ -395,9 +396,26 @@ public class DeploymentTriggerTest { assertTrue(tester.deploymentQueue().jobs().isEmpty()); // Deploy the new application version, even though the platform version is already deployed in us-central-1. - tester.deployCompletely(application, applicationPackage, BuildJob.defaultBuildNumber + 1); + // Let it fail in us-central-1 after deployment, so we can test this zone is later skipped. + tester.completeDeploymentWithError(application, applicationPackage, BuildJob.defaultBuildNumber + 1, productionUsCentral1); + tester.deploy(productionUsCentral1, application, Optional.empty(), false); + assertEquals(ApplicationVersion.from(BuildJob.defaultSourceRevision, BuildJob.defaultBuildNumber + 1), app.get().deployments().get(ZoneId.from("prod.us-central-1")).applicationVersion()); + + // Exhaust the automatic retry. + tester.clock().advance(Duration.ofHours(1)); + tester.deployAndNotify(application, Optional.empty(), false, true, productionUsCentral1); + assertTrue(tester.deploymentQueue().jobs().isEmpty()); + + // Let the ReadyJobTrigger get what it thinks is the next job -- should be the last job. + tester.readyJobTrigger().maintain(); + assertEquals(Collections.singletonList(new BuildService.BuildJob(1, productionEuWest1.jobName())), + tester.deploymentQueue().jobs()); + tester.deploy(productionEuWest1, application, Optional.empty(), false); + tester.deployAndNotify(application, Optional.empty(), false, true, productionEuWest1); + assertFalse(app.get().change().isPresent()); + assertTrue(tester.deploymentQueue().jobs().isEmpty()); } @Test -- cgit v1.2.3