diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2019-10-25 14:34:06 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2019-10-25 14:34:06 +0200 |
commit | 84d08d3fdcd7604849846bf1f1ad28c45861f401 (patch) | |
tree | c9cb60c6e0d622173639170d3036a0fc667cf3dd | |
parent | 95b9880b335724e3342136d1cbaae1befad8454f (diff) |
Update DeploymentExpirerTest
2 files changed, 22 insertions, 12 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java index 98ee3643bab..206db46ac27 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java @@ -422,6 +422,12 @@ public class InternalDeploymentTester { routing.removeEndpoints(new DeploymentId(TesterId.of(job.application()).id(), zone)); } + /** Starts a manual deployment of the given package, and then runs the whole of the given job, successfully. */ + public void runJob(ApplicationId instanceId, JobType type, ApplicationPackage applicationPackage) { + jobs.deploy(instanceId, type, Optional.empty(), applicationPackage); + runJob(new JobId(instanceId, type)); + } + /** Pulls the ready job trigger, and then runs the whole of the given job, successfully. */ public void runJob(JobType type) { runJob(instanceId, type); @@ -429,11 +435,13 @@ public class InternalDeploymentTester { /** Pulls the ready job trigger, and then runs the whole of the given job, successfully. */ public void runJob(ApplicationId instanceId, JobType type) { + if (type.environment().isManuallyDeployed()) + throw new IllegalArgumentException("Use overload with application package for dev/perf jobs"); runJob(new JobId(instanceId, type)); } /** Pulls the ready job trigger, and then runs the whole of the given job, successfully. */ - public void runJob(JobId job) { + private void runJob(JobId job) { triggerJobs(); doDeploy(job); doUpgrade(job); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java index d43526ce5fa..222ec9dfb66 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java @@ -6,10 +6,11 @@ import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.zone.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Instance; +import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.Deployment; import com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder; -import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; +import com.yahoo.vespa.hosted.controller.deployment.InternalDeploymentTester; import com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb; import org.junit.Test; @@ -24,7 +25,7 @@ import static org.junit.Assert.assertEquals; */ public class DeploymentExpirerTest { - private final DeploymentTester tester = new DeploymentTester(); + private final InternalDeploymentTester tester = new InternalDeploymentTester(); @Test public void testDeploymentExpiry() { @@ -34,20 +35,21 @@ public class DeploymentExpirerTest { ); DeploymentExpirer expirer = new DeploymentExpirer(tester.controller(), Duration.ofDays(10), new JobControl(new MockCuratorDb())); - Application devApp = tester.createApplication("app1", "tenant1", 123L, 1L); - Application prodApp = tester.createApplication("app2", "tenant2", 456L, 2L); + Application devApp = tester.createApplication("tenant1", "app1", "default"); + Application prodApp = tester.createApplication("tenant2", "app2", "default"); - Instance devInstance = tester.defaultInstance(devApp.id()); - Instance prodInstance = tester.defaultInstance(prodApp.id()); + ApplicationPackage appPackage = new ApplicationPackageBuilder() + .region("us-west-1") + .build(); + + Instance devInstance = tester.instance(devApp.id().defaultInstance()); + Instance prodInstance = tester.instance(prodApp.id().defaultInstance()); // Deploy dev - tester.controllerTester().deploy(devInstance.id(), tester.controllerTester().toZone(Environment.dev)); + tester.runJob(devInstance.id(), JobType.devUsEast1, appPackage); // Deploy prod - ApplicationPackage prodAppPackage = new ApplicationPackageBuilder() - .region("us-west-1") - .build(); - tester.deployCompletely(prodApp, prodAppPackage); + tester.deployNewSubmission(prodApp.id(), tester.newSubmission(prodApp.id(), appPackage)); assertEquals(1, permanentDeployments(devInstance).size()); assertEquals(1, permanentDeployments(prodInstance).size()); |