Search in sources :

Example 1 with ReadyJobsTrigger

use of com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger in project vespa by vespa-engine.

the class DeploymentTriggerTest method testUpgradingButNoJobStarted.

@Test
public void testUpgradingButNoJobStarted() {
    DeploymentTester tester = new DeploymentTester();
    ReadyJobsTrigger readyJobsTrigger = new ReadyJobsTrigger(tester.controller(), Duration.ofHours(1), new JobControl(tester.controllerTester().curator()));
    LockedApplication app = (LockedApplication) tester.createAndDeploy("default0", 3, "default");
    // Store that we are upgrading but don't start the system-tests job
    tester.controller().applications().store(app.withChange(Change.of(Version.fromString("6.2"))));
    assertEquals(0, tester.deploymentQueue().jobs().size());
    readyJobsTrigger.run();
    assertEquals(1, tester.deploymentQueue().jobs().size());
    assertEquals("system-test", tester.deploymentQueue().jobs().get(0).jobName());
}
Also used : LockedApplication(com.yahoo.vespa.hosted.controller.LockedApplication) JobControl(com.yahoo.vespa.hosted.controller.maintenance.JobControl) ReadyJobsTrigger(com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger) 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 ReadyJobsTrigger

use of com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger in project vespa by vespa-engine.

the class DeploymentTriggerTest method testBlockRevisionChange.

@Test
public void testBlockRevisionChange() {
    // Tuesday, 17:30
    ManualClock clock = new ManualClock(Instant.parse("2017-09-26T17:30:00.00Z"));
    DeploymentTester tester = new DeploymentTester(new ControllerTester(clock));
    ReadyJobsTrigger readyJobsTrigger = new ReadyJobsTrigger(tester.controller(), Duration.ofHours(1), new JobControl(tester.controllerTester().curator()));
    Version version = Version.fromString("5.0");
    tester.updateVersionStatus(version);
    ApplicationPackageBuilder applicationPackageBuilder = new ApplicationPackageBuilder().upgradePolicy("canary").blockChange(true, false, "tue", "18-19", "UTC").region("us-west-1").region("us-central-1").region("us-east-3");
    Application app = tester.createAndDeploy("app1", 1, applicationPackageBuilder.build());
    // --------------- Enter block window: 18:30
    tester.clock().advance(Duration.ofHours(1));
    readyJobsTrigger.run();
    assertEquals(0, tester.deploymentQueue().jobs().size());
    String searchDefinition = "search test {\n" + "  document test {\n" + "    field test type string {\n" + "    }\n" + "  }\n" + "}\n";
    ApplicationPackage changedApplication = applicationPackageBuilder.searchDefinition(searchDefinition).build();
    tester.jobCompletion(component).application(app).nextBuildNumber().sourceRevision(new SourceRevision("repository1", "master", "cafed00d")).uploadArtifact(changedApplication).submit();
    assertTrue(tester.applications().require(app.id()).change().isPresent());
    tester.deployAndNotify(app, changedApplication, true, systemTest);
    tester.deployAndNotify(app, changedApplication, true, stagingTest);
    readyJobsTrigger.run();
    assertEquals(0, tester.deploymentQueue().jobs().size());
    // ---------------- Exit block window: 20:30
    tester.clock().advance(Duration.ofHours(2));
    // Schedules the blocked production job(s)
    tester.deploymentTrigger().triggerReadyJobs();
    assertEquals(1, tester.deploymentQueue().jobs().size());
    BuildService.BuildJob productionJob = tester.deploymentQueue().takeJobsToRun().get(0);
    assertEquals("production-us-west-1", productionJob.jobName());
}
Also used : SourceRevision(com.yahoo.vespa.hosted.controller.application.SourceRevision) BuildService(com.yahoo.vespa.hosted.controller.api.integration.BuildService) JobControl(com.yahoo.vespa.hosted.controller.maintenance.JobControl) ReadyJobsTrigger(com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) ControllerTester(com.yahoo.vespa.hosted.controller.ControllerTester) ManualClock(com.yahoo.test.ManualClock) 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) 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

LockedApplication (com.yahoo.vespa.hosted.controller.LockedApplication)2 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)2 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)2 JobControl (com.yahoo.vespa.hosted.controller.maintenance.JobControl)2 ReadyJobsTrigger (com.yahoo.vespa.hosted.controller.maintenance.ReadyJobsTrigger)2 Test (org.junit.Test)2 Version (com.yahoo.component.Version)1 ManualClock (com.yahoo.test.ManualClock)1 Application (com.yahoo.vespa.hosted.controller.Application)1 ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)1 BuildService (com.yahoo.vespa.hosted.controller.api.integration.BuildService)1 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)1 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)1 SourceRevision (com.yahoo.vespa.hosted.controller.application.SourceRevision)1