use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest 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.DeploymentJobs.JobType.stagingTest 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.DeploymentJobs.JobType.stagingTest 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());
}
use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest in project vespa by vespa-engine.
the class DeploymentTriggerTest method testHandleMultipleNotificationsFromLastJob.
@Test
public void testHandleMultipleNotificationsFromLastJob() {
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").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);
// Extra notification for last job
tester.jobCompletion(JobType.productionCorpUsEast1).application(application).submit();
assertFalse("Change has been deployed", tester.applications().require(application.id()).change().isPresent());
assertTrue("All jobs consumed", deploymentQueue.jobs().isEmpty());
}
use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest in project vespa by vespa-engine.
the class DeploymentTriggerTest method testSuccessfulDeploymentApplicationPackageChanged.
@Test
public void testSuccessfulDeploymentApplicationPackageChanged() {
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 previousApplicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("corp-us-east-1").region("us-central-1").region("us-west-1").build();
ApplicationPackage newApplicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("corp-us-east-1").region("us-central-1").region("us-west-1").region("eu-west-1").build();
// Component job finishes
tester.jobCompletion(component).application(application).uploadArtifact(newApplicationPackage).submit();
// Application is deployed to all test environments and declared zones
tester.deployAndNotify(application, newApplicationPackage, true, JobType.systemTest);
tester.deploy(JobType.stagingTest, application, previousApplicationPackage, true);
tester.deployAndNotify(application, newApplicationPackage, true, JobType.stagingTest);
tester.deployAndNotify(application, newApplicationPackage, true, JobType.productionCorpUsEast1);
tester.deployAndNotify(application, newApplicationPackage, true, JobType.productionUsCentral1);
tester.deployAndNotify(application, newApplicationPackage, true, JobType.productionUsWest1);
tester.deployAndNotify(application, newApplicationPackage, true, JobType.productionEuWest1);
assertTrue("All jobs consumed", deploymentQueue.jobs().isEmpty());
}
Aggregations