use of com.yahoo.vespa.hosted.controller.application.ApplicationPackage in project vespa by vespa-engine.
the class DeploymentTriggerTest method deploymentSpecWithParallelDeployments.
@Test
public void deploymentSpecWithParallelDeployments() {
DeploymentTester tester = new DeploymentTester();
Application application = tester.createApplication("app1", "tenant1", 1, 1L);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("us-central-1").parallel("us-west-1", "us-east-3").region("eu-west-1").build();
// Component job finishes
tester.jobCompletion(component).application(application).uploadArtifact(applicationPackage).submit();
// Test jobs pass
tester.deployAndNotify(application, applicationPackage, true, JobType.systemTest);
tester.deployAndNotify(application, applicationPackage, true, JobType.stagingTest);
// Deploys in first region
assertEquals(1, tester.deploymentQueue().jobs().size());
tester.deployAndNotify(application, applicationPackage, true, JobType.productionUsCentral1);
// Deploys in two regions in parallel
assertEquals(2, tester.deploymentQueue().jobs().size());
assertEquals(JobType.productionUsEast3.jobName(), tester.deploymentQueue().jobs().get(0).jobName());
assertEquals(JobType.productionUsWest1.jobName(), tester.deploymentQueue().jobs().get(1).jobName());
tester.deploymentQueue().takeJobsToRun();
tester.deploy(JobType.productionUsWest1, application, applicationPackage, false);
tester.jobCompletion(JobType.productionUsWest1).application(application).submit();
assertTrue("No more jobs triggered at this time", tester.deploymentQueue().jobs().isEmpty());
tester.deploy(JobType.productionUsEast3, application, applicationPackage, false);
tester.jobCompletion(JobType.productionUsEast3).application(application).submit();
// Last region completes
assertEquals(1, tester.deploymentQueue().jobs().size());
tester.deployAndNotify(application, applicationPackage, true, JobType.productionEuWest1);
assertTrue("All jobs consumed", tester.deploymentQueue().jobs().isEmpty());
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationPackage in project vespa by vespa-engine.
the class DeploymentTriggerTest method deploymentsSpecWithDelays.
@Test
public void deploymentsSpecWithDelays() {
DeploymentTester tester = new DeploymentTester();
DeploymentQueue deploymentQueue = tester.deploymentQueue();
Application application = tester.createApplication("app1", "tenant1", 1, 1L);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).delay(Duration.ofSeconds(30)).region("us-west-1").delay(Duration.ofMinutes(1)).delay(// Multiple delays are summed up
Duration.ofMinutes(2)).region("us-central-1").delay(// Delays after last region are valid, but have no effect
Duration.ofMinutes(10)).build();
// Component job finishes
tester.jobCompletion(component).application(application).uploadArtifact(applicationPackage).submit();
// Test jobs pass
tester.deployAndNotify(application, applicationPackage, true, JobType.systemTest);
// Make staging test sort as the last successful job
tester.clock().advance(Duration.ofSeconds(1));
tester.deployAndNotify(application, applicationPackage, true, JobType.stagingTest);
assertTrue("No more jobs triggered at this time", deploymentQueue.jobs().isEmpty());
// 30 seconds pass, us-west-1 is triggered
tester.clock().advance(Duration.ofSeconds(30));
tester.deploymentTrigger().triggerReadyJobs();
// Consume us-west-1 job without reporting completion
assertEquals(1, deploymentQueue.jobs().size());
assertEquals(JobType.productionUsWest1.jobName(), deploymentQueue.jobs().get(0).jobName());
deploymentQueue.takeJobsToRun();
// 3 minutes pass, delayed trigger does nothing as us-west-1 is still in progress
tester.clock().advance(Duration.ofMinutes(3));
tester.deploymentTrigger().triggerReadyJobs();
assertTrue("No more jobs triggered at this time", deploymentQueue.jobs().isEmpty());
// us-west-1 completes
tester.deploy(JobType.productionUsWest1, application, applicationPackage);
tester.jobCompletion(JobType.productionUsWest1).application(application).submit();
// Delayed trigger does nothing as not enough time has passed after us-west-1 completion
tester.deploymentTrigger().triggerReadyJobs();
assertTrue("No more jobs triggered at this time", deploymentQueue.jobs().isEmpty());
// 3 minutes pass, us-central-1 is triggered
tester.clock().advance(Duration.ofMinutes(3));
tester.deploymentTrigger().triggerReadyJobs();
tester.deployAndNotify(application, applicationPackage, true, JobType.productionUsCentral1);
assertTrue("All jobs consumed", deploymentQueue.jobs().isEmpty());
// Delayed trigger job runs again, with nothing to trigger
tester.clock().advance(Duration.ofMinutes(10));
tester.deploymentTrigger().triggerReadyJobs();
assertTrue("All jobs consumed", deploymentQueue.jobs().isEmpty());
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationPackage in project vespa by vespa-engine.
the class DeploymentTriggerTest method dualChangesAreNotSkippedWhenOnePartIsDeployedAlready.
@Test
public void dualChangesAreNotSkippedWhenOnePartIsDeployedAlready() {
DeploymentTester tester = new DeploymentTester();
Application application = tester.createApplication("app1", "tenant1", 1, 1L);
Supplier<Application> app = () -> tester.application(application.id());
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("us-central-1").region("eu-west-1").build();
tester.deployCompletely(application, applicationPackage);
// Platform upgrade which doesn't succeed, allowing a dual change.
Version version1 = new Version("7.1");
tester.upgradeSystem(version1);
tester.completeUpgradeWithError(application, version1, applicationPackage, productionEuWest1);
// Deploy the new application version, even though the platform version is already deployed in us-central-1.
// Let it fail in us-central-1 after deployment, so we can test this zone is later skipped.
tester.jobCompletion(component).application(application).nextBuildNumber().uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(application, applicationPackage, true, false, systemTest);
tester.deployAndNotify(application, applicationPackage, true, false, stagingTest);
tester.jobCompletion(productionEuWest1).application(application).unsuccessful().submit();
tester.deploy(productionUsCentral1, application, Optional.empty(), false);
// Deploying before notifying here makes the job not re-trigger, but instead triggers the next job (because of triggerReadyJobs() in notification.)
tester.deployAndNotify(application, applicationPackage, false, productionUsCentral1);
assertEquals(ApplicationVersion.from(BuildJob.defaultSourceRevision, BuildJob.defaultBuildNumber + 1), app.get().deployments().get(ZoneId.from("prod.us-central-1")).applicationVersion());
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());
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationPackage in project vespa by vespa-engine.
the class DeploymentTriggerTest method parallelDeploymentCompletesOutOfOrder.
@Test
public void parallelDeploymentCompletesOutOfOrder() {
DeploymentTester tester = new DeploymentTester();
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).parallel("us-east-3", "us-west-1").build();
Application app = tester.createApplication("app1", "tenant1", 1, 11L);
tester.jobCompletion(component).application(app).uploadArtifact(applicationPackage).submit();
// Test environments pass
tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest);
tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest);
// Last declared job completes first
tester.deploy(DeploymentJobs.JobType.productionUsWest1, app, applicationPackage);
tester.jobCompletion(DeploymentJobs.JobType.productionUsWest1).application(app).submit();
assertTrue("Change is present as not all jobs are complete", tester.applications().require(app.id()).change().isPresent());
// All jobs complete
tester.deploy(DeploymentJobs.JobType.productionUsEast3, app, applicationPackage);
tester.jobCompletion(JobType.productionUsEast3).application(app).submit();
assertFalse("Change has been deployed", tester.applications().require(app.id()).change().isPresent());
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationPackage in project vespa by vespa-engine.
the class DeploymentTriggerTest method deploymentSpecDecidesTriggerOrder.
@Test
public void deploymentSpecDecidesTriggerOrder() {
DeploymentTester tester = new DeploymentTester();
DeploymentQueue deploymentQueue = tester.deploymentQueue();
TenantId tenant = tester.controllerTester().createTenant("tenant1", "domain1", 1L);
Application application = tester.controllerTester().createApplication(tenant, "app1", "default", 1L);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("corp-us-east-1").region("us-central-1").region("us-west-1").build();
// Component job finishes
tester.jobCompletion(component).application(application).uploadArtifact(applicationPackage).submit();
// Application is deployed to all test environments and declared zones
tester.deployAndNotify(application, applicationPackage, true, JobType.systemTest);
tester.deployAndNotify(application, applicationPackage, true, JobType.stagingTest);
tester.deployAndNotify(application, applicationPackage, true, JobType.productionCorpUsEast1);
tester.deployAndNotify(application, applicationPackage, true, JobType.productionUsCentral1);
tester.deployAndNotify(application, applicationPackage, true, JobType.productionUsWest1);
assertTrue("All jobs consumed", deploymentQueue.jobs().isEmpty());
}
Aggregations