diff options
author | Martin Polden <mpolden@mpolden.no> | 2019-10-25 15:44:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-25 15:44:53 +0200 |
commit | f8d607f4b6ec8aca16731141da3317def4ebdc32 (patch) | |
tree | 6537b82f92e2d2f24161268674d129adc60b71f9 | |
parent | 4bc2dbc4e3ff6d5dd08db7b1bf17a28c34f291e2 (diff) | |
parent | dba101b3480b13ae23cde260f45d6aba1279e5f6 (diff) |
Merge pull request #11109 from vespa-engine/jvenstad/migrate-more-tests
Jvenstad/migrate more tests
7 files changed, 80 insertions, 84 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 b2e2288dc51..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 @@ -104,12 +104,15 @@ public class InternalDeploymentTester { public JobRunner runner() { return runner; } public ConfigServerMock configServer() { return tester.configServer(); } public Controller controller() { return tester.controller(); } + public DeploymentTrigger deploymentTrigger() { return tester.deploymentTrigger(); } public ControllerTester controllerTester() { return tester.controllerTester(); } public Upgrader upgrader() { return tester.upgrader(); } public ApplicationController applications() { return tester.applications(); } public ManualClock clock() { return tester.clock(); } public Application application() { return tester.application(appId); } + public Application application(TenantAndApplicationId id ) { return tester.application(id); } public Instance instance() { return tester.instance(instanceId); } + public Instance instance(ApplicationId id) { return tester.instance(id); } public InternalDeploymentTester() { tester = new DeploymentTester(); @@ -419,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); @@ -426,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/ApplicationOwnershipConfirmerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java index 5f210969b4d..68c95739ec6 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/ApplicationOwnershipConfirmerTest.java @@ -3,28 +3,26 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.InstanceName; -import com.yahoo.config.provision.TenantName; import com.yahoo.vespa.hosted.controller.Application; -import com.yahoo.vespa.hosted.controller.Instance; +import com.yahoo.vespa.hosted.controller.LockedTenant; import com.yahoo.vespa.hosted.controller.api.integration.organization.ApplicationSummary; import com.yahoo.vespa.hosted.controller.api.integration.organization.Contact; import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; import com.yahoo.vespa.hosted.controller.api.integration.organization.OwnershipIssues; import com.yahoo.vespa.hosted.controller.api.integration.organization.User; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; -import com.yahoo.vespa.hosted.controller.tenant.UserTenant; -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 com.yahoo.vespa.hosted.controller.tenant.UserTenant; import org.junit.Before; import org.junit.Test; import java.time.Duration; -import java.util.Collection; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.function.Supplier; +import static com.yahoo.vespa.hosted.controller.deployment.InternalDeploymentTester.appId; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -36,11 +34,11 @@ public class ApplicationOwnershipConfirmerTest { private MockOwnershipIssues issues; private ApplicationOwnershipConfirmer confirmer; - private DeploymentTester tester; + private InternalDeploymentTester tester; @Before public void setup() { - tester = new DeploymentTester(); + tester = new InternalDeploymentTester(); issues = new MockOwnershipIssues(); confirmer = new ApplicationOwnershipConfirmer(tester.controller(), Duration.ofDays(1), new JobControl(new MockCuratorDb()), issues); } @@ -48,14 +46,17 @@ public class ApplicationOwnershipConfirmerTest { @Test public void testConfirmation() { Optional<Contact> contact = Optional.of(tester.controllerTester().serviceRegistry().contactRetrieverMock().contact()); - TenantName property = tester.controllerTester().createTenant("property", "domain", 1L, contact); - tester.createAndDeploy(property, "application", 1, "default"); - Supplier<Application> propertyApp = () -> tester.controller().applications().requireApplication(TenantAndApplicationId.from("property", "application")); + tester.controller().tenants().lockOrThrow(appId.tenant(), LockedTenant.Athenz.class, tenant -> + tester.controller().tenants().store(tenant.with(contact.get()))); + Supplier<Application> propertyApp = tester::application; + tester.deployNewSubmission(tester.newSubmission()); UserTenant user = UserTenant.create("by-user", contact); tester.controller().tenants().createUser(user); - tester.createAndDeploy(user.name(), "application", 2, "default"); - Supplier<Application> userApp = () -> tester.controller().applications().requireApplication(TenantAndApplicationId.from("by-user", "application")); + tester.createApplication(user.name().value(), "application", "default"); + TenantAndApplicationId userAppId = TenantAndApplicationId.from("by-user", "application"); + Supplier<Application> userApp = () -> tester.controller().applications().requireApplication(userAppId); + tester.deployNewSubmission(userAppId, tester.newSubmission(userAppId, InternalDeploymentTester.applicationPackage)); assertFalse("No issue is initially stored for a new application.", propertyApp.get().ownershipIssueId().isPresent()); assertFalse("No issue is initially stored for a new application.", userApp.get().ownershipIssueId().isPresent()); @@ -85,15 +86,9 @@ public class ApplicationOwnershipConfirmerTest { assertEquals("Confirmation issue reference is not updated when no issue id is returned.", issueId, userApp.get().ownershipIssueId()); // The user deletes all production deployments — see that the issue is forgotten. - assertEquals("Confirmation issue for user is sitll open.", issueId, userApp.get().ownershipIssueId()); - tester.controller().applications().deactivate(userApp.get().id().defaultInstance(), - userApp.get().productionDeployments().values().stream() - .flatMap(List::stream) - .findAny().get().zone()); - tester.controller().applications().deactivate(userApp.get().id().defaultInstance(), - userApp.get().productionDeployments().values().stream() - .flatMap(List::stream) - .findAny().get().zone()); + assertEquals("Confirmation issue for user is still open.", issueId, userApp.get().ownershipIssueId()); + userApp.get().productionDeployments().values().stream().flatMap(List::stream) + .forEach(deployment -> tester.controller().applications().deactivate(userAppId.defaultInstance(), deployment.zone())); assertTrue("No production deployments are listed for user.", userApp.get().require(InstanceName.defaultName()).productionDeployments().isEmpty()); confirmer.maintain(); 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()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java index 9df0e99787d..fdc8185a45f 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentIssueReporterTest.java @@ -5,7 +5,6 @@ import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.vespa.hosted.controller.Application; -import com.yahoo.vespa.hosted.controller.Instance; import com.yahoo.vespa.hosted.controller.LockedTenant; import com.yahoo.vespa.hosted.controller.api.integration.organization.Contact; import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; @@ -14,7 +13,6 @@ import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; 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 com.yahoo.vespa.hosted.controller.versions.VespaVersion; @@ -24,10 +22,8 @@ import org.junit.Test; import java.time.Duration; import java.util.HashMap; import java.util.Map; -import java.util.Optional; import static com.yahoo.config.application.api.DeploymentSpec.UpgradePolicy.canary; -import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.component; import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.productionUsWest1; import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.stagingTest; import static com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType.systemTest; @@ -68,12 +64,6 @@ public class DeploymentIssueReporterTest { public void testDeploymentFailureReporting() { tester.controllerTester().upgradeSystem(Version.fromString("6.2")); - /* - tester.controllerTester().createTenant("tenant1", "domain1", 1L, contact); - tester.controllerTester().createTenant("tenant2", "domain2", 1L, contact); - tester.controllerTester().createTenant("tenant3", "domain3", 1L, contact); - */ - // Create and deploy one application for each of three tenants. Application app1 = tester.createApplication("application1", "tenant1", "default"); Application app2 = tester.createApplication("application2", "tenant2", "default"); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java index fe1d51b8dba..7a341dc7441 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/JobRunnerTest.java @@ -3,13 +3,12 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; -import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.api.integration.deployment.ApplicationVersion; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; import com.yahoo.vespa.hosted.controller.api.integration.deployment.SourceRevision; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.TenantAndApplicationId; -import com.yahoo.vespa.hosted.controller.deployment.DeploymentTester; +import com.yahoo.vespa.hosted.controller.deployment.InternalDeploymentTester; import com.yahoo.vespa.hosted.controller.deployment.JobController; import com.yahoo.vespa.hosted.controller.deployment.Run; import com.yahoo.vespa.hosted.controller.deployment.RunStatus; @@ -77,14 +76,14 @@ public class JobRunnerTest { @Test public void multiThreadedExecutionFinishes() { - DeploymentTester tester = new DeploymentTester(); + InternalDeploymentTester tester = new InternalDeploymentTester(); JobController jobs = tester.controller().jobController(); StepRunner stepRunner = (step, id) -> id.type() == stagingTest && step.get() == startTests? Optional.of(error) : Optional.of(running); Phaser phaser = new Phaser(1); JobRunner runner = new JobRunner(tester.controller(), Duration.ofDays(1), new JobControl(tester.controller().curator()), phasedExecutor(phaser), stepRunner); - TenantAndApplicationId appId = tester.createApplication("real", "tenant", 1, 1L).id(); + TenantAndApplicationId appId = tester.createApplication("tenant", "real", "default").id(); ApplicationId id = appId.defaultInstance(); jobs.submit(appId, versions.targetApplication().source().get(), "a@b", 2, applicationPackage, new byte[0]); @@ -110,13 +109,13 @@ public class JobRunnerTest { @Test public void stepLogic() { - DeploymentTester tester = new DeploymentTester(); + InternalDeploymentTester tester = new InternalDeploymentTester(); JobController jobs = tester.controller().jobController(); Map<Step, RunStatus> outcomes = new EnumMap<>(Step.class); JobRunner runner = new JobRunner(tester.controller(), Duration.ofDays(1), new JobControl(tester.controller().curator()), inThreadExecutor(), mappedRunner(outcomes)); - TenantAndApplicationId appId = tester.createApplication("real", "tenant", 1, 1L).id(); + TenantAndApplicationId appId = tester.createApplication("tenant", "real", "default").id(); ApplicationId id = appId.defaultInstance(); jobs.submit(appId, versions.targetApplication().source().get(), "a@b", 2, applicationPackage, new byte[0]); Supplier<Run> run = () -> jobs.last(id, systemTest).get(); @@ -198,14 +197,14 @@ public class JobRunnerTest { @Test public void locksAndGarbage() throws InterruptedException, BrokenBarrierException { - DeploymentTester tester = new DeploymentTester(); + InternalDeploymentTester tester = new InternalDeploymentTester(); JobController jobs = tester.controller().jobController(); // Hang during tester deployment, until notified. CyclicBarrier barrier = new CyclicBarrier(2); JobRunner runner = new JobRunner(tester.controller(), Duration.ofDays(1), new JobControl(tester.controller().curator()), Executors.newFixedThreadPool(32), waitingRunner(barrier)); - TenantAndApplicationId appId = tester.createApplication("real", "tenant", 1, 1L).id(); + TenantAndApplicationId appId = tester.createApplication("tenant", "real", "default").id(); ApplicationId id = appId.defaultInstance(); jobs.submit(appId, versions.targetApplication().source().get(), "a@b", 2, applicationPackage, new byte[0]); @@ -237,12 +236,12 @@ public class JobRunnerTest { @Test public void historyPruning() { - DeploymentTester tester = new DeploymentTester(); + InternalDeploymentTester tester = new InternalDeploymentTester(); JobController jobs = tester.controller().jobController(); JobRunner runner = new JobRunner(tester.controller(), Duration.ofDays(1), new JobControl(tester.controller().curator()), inThreadExecutor(), (id, step) -> Optional.of(running)); - TenantAndApplicationId appId = tester.createApplication("real", "tenant", 1, 1L).id(); + TenantAndApplicationId appId = tester.createApplication("tenant", "real", "default").id(); ApplicationId id = appId.defaultInstance(); jobs.submit(appId, versions.targetApplication().source().get(), "a@b", 2, applicationPackage, new byte[0]); @@ -265,13 +264,13 @@ public class JobRunnerTest { @Test public void timeout() { - DeploymentTester tester = new DeploymentTester(); + InternalDeploymentTester tester = new InternalDeploymentTester(); JobController jobs = tester.controller().jobController(); Map<Step, RunStatus> outcomes = new EnumMap<>(Step.class); JobRunner runner = new JobRunner(tester.controller(), Duration.ofDays(1), new JobControl(tester.controller().curator()), inThreadExecutor(), mappedRunner(outcomes)); - TenantAndApplicationId appId = tester.createApplication("real", "tenant", 1, 1L).id(); + TenantAndApplicationId appId = tester.createApplication("tenant", "real", "default").id(); ApplicationId id = appId.defaultInstance(); jobs.submit(appId, versions.targetApplication().source().get(), "a@b", 2, applicationPackage, new byte[0]); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java index bec2c9c7bc4..92ee2a2ebdb 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java @@ -2,6 +2,7 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.component.Version; +import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Instance; @@ -12,6 +13,8 @@ import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.api.integration.deployment.SourceRevision; 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.deployment.Run; import com.yahoo.vespa.hosted.controller.persistence.MockCuratorDb; import org.junit.Test; @@ -30,7 +33,7 @@ public class OutstandingChangeDeployerTest { @Test public void testChangeDeployer() { - DeploymentTester tester = new DeploymentTester(); + InternalDeploymentTester tester = new InternalDeploymentTester(); OutstandingChangeDeployer deployer = new OutstandingChangeDeployer(tester.controller(), Duration.ofMinutes(10), new JobControl(new MockCuratorDb())); ApplicationPackage applicationPackage = new ApplicationPackageBuilder() @@ -38,8 +41,8 @@ public class OutstandingChangeDeployerTest { .region("us-west-1") .build(); - Application app1 = tester.createAndDeploy("app1", 11, applicationPackage); - Application app2 = tester.createAndDeploy("app2", 22, applicationPackage); + Application app1 = tester.createApplication("tenant", "app1", "default"); + tester.deployNewSubmission(app1.id(), tester.newSubmission(app1.id(), applicationPackage)); Version version = new Version(6, 2); tester.deploymentTrigger().triggerChange(app1.id(), Change.of(version)); @@ -48,38 +51,35 @@ public class OutstandingChangeDeployerTest { assertEquals(Change.of(version), tester.application(app1.id()).change()); assertFalse(tester.application(app1.id()).outstandingChange().hasTargets()); - tester.jobCompletion(JobType.component) - .application(app1) - .sourceRevision(new SourceRevision("repository1","master", "cafed00d")) - .nextBuildNumber() - .uploadArtifact(applicationPackage) - .submit(); + assertEquals(1, tester.application(app1.id()).latestVersion().get().buildNumber().getAsLong()); + tester.newSubmission(app1.id(), applicationPackage, new SourceRevision("repository1","master", "cafed00d"), + "author@domain", app1.projectId().getAsLong()); - Instance instance = tester.defaultInstance("app1"); + ApplicationId instanceId = app1.id().defaultInstance(); assertTrue(tester.application(app1.id()).outstandingChange().hasTargets()); - assertEquals("1.0.43-cafed00d", tester.application(app1.id()).outstandingChange().application().get().id()); - assertEquals(2, tester.buildService().jobs().size()); + assertEquals("1.0.2-cafed00d", tester.application(app1.id()).outstandingChange().application().get().id()); + tester.assertRunning(instanceId, JobType.systemTest); + tester.assertRunning(instanceId, JobType.stagingTest); + assertEquals(2, tester.jobs().active().size()); deployer.maintain(); tester.deploymentTrigger().triggerReadyJobs(); - assertEquals("No effect as job is in progress", 2, tester.buildService().jobs().size()); - assertEquals("1.0.43-cafed00d", tester.application(app1.id()).outstandingChange().application().get().id()); + assertEquals("No effect as job is in progress", 2, tester.jobs().active().size()); + assertEquals("1.0.2-cafed00d", tester.application(app1.id()).outstandingChange().application().get().id()); - tester.deployAndNotify(instance.id(), Optional.of(applicationPackage), true, JobType.systemTest); - tester.deployAndNotify(instance.id(), Optional.of(applicationPackage), true, JobType.stagingTest); - tester.deployAndNotify(instance.id(), Optional.of(applicationPackage), true, JobType.productionUsWest1); - tester.deployAndNotify(instance.id(), Optional.of(applicationPackage), true, JobType.systemTest); - tester.deployAndNotify(instance.id(), Optional.of(applicationPackage), true, JobType.stagingTest); - assertEquals("Upgrade done", 0, tester.buildService().jobs().size()); + tester.runJob(instanceId, JobType.systemTest); + tester.runJob(instanceId, JobType.stagingTest); + tester.runJob(instanceId, JobType.productionUsWest1); + tester.runJob(instanceId, JobType.systemTest); + tester.runJob(instanceId, JobType.stagingTest); + assertEquals("Upgrade done", 0, tester.jobs().active().size()); deployer.maintain(); tester.deploymentTrigger().triggerReadyJobs(); - instance = tester.defaultInstance("app1"); - assertEquals("1.0.43-cafed00d", tester.application(app1.id()).change().application().get().id()); - List<BuildService.BuildJob> jobs = tester.buildService().jobs(); - assertEquals(1, jobs.size()); - assertEquals(JobType.productionUsWest1.jobName(), jobs.get(0).jobName()); - assertEquals(app1.id().defaultInstance(), jobs.get(0).applicationId()); + assertEquals("1.0.2-cafed00d", tester.application(app1.id()).change().application().get().id()); + List<Run> runs = tester.jobs().active(); + assertEquals(1, runs.size()); + tester.assertRunning(instanceId, JobType.productionUsWest1); assertFalse(tester.application(app1.id()).outstandingChange().hasTargets()); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java index 65cd4a08841..184f75bfd18 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java @@ -119,8 +119,7 @@ public class JobControllerApiHandlerHelperTest { assertResponse(JobControllerApiHandlerHelper.runDetailsResponse(tester.jobs(), tester.jobs().last(instanceId, productionUsEast3).get().id(), "0"), "us-east-3-log-without-first.json"); assertResponse(JobControllerApiHandlerHelper.jobTypeResponse(tester.tester().controller(), instanceId, URI.create("https://some.url:43/root/")), "overview.json"); - tester.jobs().deploy(instanceId, JobType.devAwsUsEast2a, Optional.empty(), applicationPackage); - tester.runJob(JobType.devAwsUsEast2a); + tester.runJob(instanceId, JobType.devAwsUsEast2a, applicationPackage); assertResponse(JobControllerApiHandlerHelper.runResponse(tester.jobs().runs(instanceId, devAwsUsEast2a), URI.create("https://some.url:43/root")), "dev-aws-us-east-2a-runs.json"); } |