Search in sources :

Example 1 with JobType.systemTest

use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest in project vespa by vespa-engine.

the class DeploymentTriggerTest method testTriggerFailing.

@Test
public void testTriggerFailing() {
    DeploymentTester tester = new DeploymentTester();
    Application app = tester.createApplication("app1", "tenant1", 1, 1L);
    ApplicationPackage applicationPackage = new ApplicationPackageBuilder().upgradePolicy("default").environment(Environment.prod).region("us-west-1").build();
    Version version = new Version(5, 1);
    tester.updateVersionStatus(version);
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    // Deploy completely once
    tester.jobCompletion(component).application(app).uploadArtifact(applicationPackage).submit();
    tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.systemTest);
    tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest);
    tester.deployAndNotify(app, applicationPackage, true, JobType.productionUsWest1);
    // New version is released
    version = new Version(5, 2);
    tester.updateVersionStatus(version);
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    // system-test fails and is retried
    tester.deployAndNotify(app, applicationPackage, false, JobType.systemTest);
    assertEquals("Job is retried on failure", 1, tester.deploymentQueue().jobs().size());
    tester.deployAndNotify(app, applicationPackage, true, JobType.systemTest);
    // staging-test times out and is retried
    tester.deploymentQueue().takeJobsToRun();
    tester.clock().advance(Duration.ofHours(12).plus(Duration.ofSeconds(1)));
    tester.readyJobTrigger().maintain();
    assertEquals("Retried dead job", 1, tester.deploymentQueue().jobs().size());
    assertEquals(JobType.stagingTest.jobName(), tester.deploymentQueue().jobs().get(0).jobName());
}
Also used : Version(com.yahoo.component.Version) ApplicationVersion(com.yahoo.vespa.hosted.controller.application.ApplicationVersion) Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Example 2 with JobType.systemTest

use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest 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());
}
Also used : Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Example 3 with JobType.systemTest

use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest 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());
}
Also used : Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Example 4 with JobType.systemTest

use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest 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());
}
Also used : TenantId(com.yahoo.vespa.hosted.controller.api.identifiers.TenantId) Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Example 5 with JobType.systemTest

use of com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest 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());
}
Also used : TenantId(com.yahoo.vespa.hosted.controller.api.identifiers.TenantId) Application(com.yahoo.vespa.hosted.controller.Application) LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest) Test(org.junit.Test) JobType.stagingTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)

Aggregations

Application (com.yahoo.vespa.hosted.controller.Application)6 LockedApplication (com.yahoo.vespa.hosted.controller.LockedApplication)6 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)6 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)6 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)6 Test (org.junit.Test)6 TenantId (com.yahoo.vespa.hosted.controller.api.identifiers.TenantId)3 Version (com.yahoo.component.Version)1 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)1