Search in sources :

Example 21 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class FailureRedeployerTest method applicationWithoutProjectIdIsNotTriggered.

@Test
public void applicationWithoutProjectIdIsNotTriggered() throws Exception {
    DeploymentTester tester = new DeploymentTester();
    // Current system version, matches version in test data
    Version version = Version.fromString("6.42.1");
    tester.configServer().setDefaultVersion(version);
    tester.updateVersionStatus(version);
    assertEquals(version, tester.controller().versionStatus().systemVersion().get().versionNumber());
    // Load test data data
    byte[] json = Files.readAllBytes(Paths.get("src/test/java/com/yahoo/vespa/hosted/controller/maintenance/testdata/application-without-project-id.json"));
    Slime slime = SlimeUtils.jsonToSlime(json);
    tester.controllerTester().createApplication(slime);
    // Failure redeployer does not restart deployment
    tester.readyJobTrigger().maintain();
    assertTrue("No jobs scheduled", tester.deploymentQueue().jobs().isEmpty());
}
Also used : Version(com.yahoo.component.Version) DeploymentTester(com.yahoo.vespa.hosted.controller.deployment.DeploymentTester) Slime(com.yahoo.slime.Slime) Test(org.junit.Test) JobType.systemTest(com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)

Example 22 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class UpgraderTest method testThrottlesUpgrades.

@Test
public void testThrottlesUpgrades() {
    DeploymentTester tester = new DeploymentTester();
    Version version = Version.fromString("5.0");
    tester.updateVersionStatus(version);
    // Setup our own upgrader as we need to control the interval
    Upgrader upgrader = new Upgrader(tester.controller(), Duration.ofMinutes(10), new JobControl(tester.controllerTester().curator()), tester.controllerTester().curator());
    upgrader.setUpgradesPerMinute(0.2);
    // Setup applications
    Application canary0 = tester.createAndDeploy("canary0", 1, "canary");
    Application canary1 = tester.createAndDeploy("canary1", 2, "canary");
    Application default0 = tester.createAndDeploy("default0", 3, "default");
    Application default1 = tester.createAndDeploy("default1", 4, "default");
    Application default2 = tester.createAndDeploy("default2", 5, "default");
    Application default3 = tester.createAndDeploy("default3", 6, "default");
    // Dev deployment which should be ignored
    Application dev0 = tester.createApplication("dev0", "tenant1", 7, 1L);
    tester.controllerTester().deploy(dev0, ZoneId.from(Environment.dev, RegionName.from("dev-region")));
    // New version is released and canaries upgrade
    version = Version.fromString("5.1");
    tester.updateVersionStatus(version);
    assertEquals(version, tester.controller().versionStatus().systemVersion().get().versionNumber());
    upgrader.maintain();
    tester.readyJobTrigger().maintain();
    assertEquals(2, tester.deploymentQueue().jobs().size());
    tester.completeUpgrade(canary0, version, "canary");
    tester.completeUpgrade(canary1, version, "canary");
    tester.updateVersionStatus(version);
    // Next run upgrades a subset
    upgrader.maintain();
    tester.readyJobTrigger().maintain();
    assertEquals(2, tester.deploymentQueue().jobs().size());
    tester.completeUpgrade(default0, version, "default");
    tester.completeUpgrade(default2, version, "default");
    // Remaining applications upgraded
    upgrader.maintain();
    tester.readyJobTrigger().maintain();
    assertEquals(2, tester.deploymentQueue().jobs().size());
    tester.completeUpgrade(default1, version, "default");
    tester.completeUpgrade(default3, version, "default");
    upgrader.maintain();
    tester.readyJobTrigger().maintain();
    assertTrue("All jobs consumed", tester.deploymentQueue().jobs().isEmpty());
}
Also used : Version(com.yahoo.component.Version) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) DeploymentTester(com.yahoo.vespa.hosted.controller.deployment.DeploymentTester) Application(com.yahoo.vespa.hosted.controller.Application) 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 23 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class UpgraderTest method testAllowApplicationChangeDuringFailingUpgrade.

@Test
public void testAllowApplicationChangeDuringFailingUpgrade() {
    DeploymentTester tester = new DeploymentTester();
    Version version = Version.fromString("5.0");
    tester.updateVersionStatus(version);
    ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("us-west-1").build();
    Application app = tester.createAndDeploy("app1", 1, applicationPackage);
    // New version is released
    version = Version.fromString("5.1");
    tester.updateVersionStatus(version);
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    tester.deployAndNotify(app, applicationPackage, true, systemTest);
    tester.deployAndNotify(app, applicationPackage, true, stagingTest);
    tester.deployAndNotify(app, applicationPackage, false, productionUsWest1);
    // New application change
    tester.jobCompletion(component).application(app).nextBuildNumber().uploadArtifact(applicationPackage).submit();
    String applicationVersion = "1.0.43-commit1";
    // Application change recorded together with ongoing upgrade
    app = tester.application(app.id());
    assertTrue("Change contains both upgrade and application change", app.change().platform().get().equals(version) && app.change().application().get().id().equals(applicationVersion));
    // Deployment completes
    tester.deployAndNotify(app, applicationPackage, true, false, systemTest);
    tester.deployAndNotify(app, applicationPackage, true, false, stagingTest);
    tester.jobCompletion(productionUsWest1).application(app).unsuccessful().submit();
    tester.deployAndNotify(app, applicationPackage, true, productionUsWest1);
    assertTrue("All jobs consumed", tester.deploymentQueue().jobs().isEmpty());
    app = tester.application(app.id());
    for (Deployment deployment : app.deployments().values()) {
        assertEquals(version, deployment.version());
        assertEquals(applicationVersion, deployment.applicationVersion().id());
    }
}
Also used : Version(com.yahoo.component.Version) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) DeploymentTester(com.yahoo.vespa.hosted.controller.deployment.DeploymentTester) ApplicationPackageBuilder(com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) Application(com.yahoo.vespa.hosted.controller.Application) 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 24 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class UpgraderTest method testConfidenceIgnoresFailingApplicationChanges.

@Test
public void testConfidenceIgnoresFailingApplicationChanges() {
    DeploymentTester tester = new DeploymentTester();
    Version version = Version.fromString("5.0");
    tester.updateVersionStatus(version);
    ApplicationPackage canaryPolicy = DeploymentTester.applicationPackage("canary");
    ApplicationPackage defaultPolicy = DeploymentTester.applicationPackage("default");
    // Setup applications
    Application canary0 = tester.createAndDeploy("canary0", 1, canaryPolicy);
    Application canary1 = tester.createAndDeploy("canary1", 2, canaryPolicy);
    Application default0 = tester.createAndDeploy("default0", 3, defaultPolicy);
    Application default1 = tester.createAndDeploy("default1", 4, defaultPolicy);
    Application default2 = tester.createAndDeploy("default2", 5, defaultPolicy);
    Application default3 = tester.createAndDeploy("default3", 6, defaultPolicy);
    Application default4 = tester.createAndDeploy("default4", 7, defaultPolicy);
    // New version is released
    version = Version.fromString("5.1");
    tester.updateVersionStatus(version);
    assertEquals(version, tester.controller().versionStatus().systemVersion().get().versionNumber());
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    // Canaries upgrade and raise confidence
    tester.completeUpgrade(canary0, version, "canary");
    tester.completeUpgrade(canary1, version, "canary");
    tester.updateVersionStatus(version);
    assertEquals(VespaVersion.Confidence.normal, tester.controller().versionStatus().systemVersion().get().confidence());
    // All applications upgrade successfully
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    tester.completeUpgrade(default0, version, "default");
    tester.completeUpgrade(default1, version, "default");
    tester.completeUpgrade(default2, version, "default");
    tester.completeUpgrade(default3, version, "default");
    tester.completeUpgrade(default4, version, "default");
    tester.updateVersionStatus(version);
    assertEquals(VespaVersion.Confidence.high, tester.controller().versionStatus().systemVersion().get().confidence());
    // Multiple application changes are triggered and fail, but does not affect version confidence as upgrade has
    // completed successfully
    tester.jobCompletion(component).application(default0).nextBuildNumber().uploadArtifact(canaryPolicy).unsuccessful().submit();
    tester.jobCompletion(component).application(default1).nextBuildNumber().uploadArtifact(canaryPolicy).unsuccessful().submit();
    tester.jobCompletion(component).application(default2).nextBuildNumber().uploadArtifact(defaultPolicy).submit();
    tester.jobCompletion(component).application(default3).nextBuildNumber().uploadArtifact(defaultPolicy).submit();
    tester.jobCompletion(component).application(default2).nextBuildNumber().uploadArtifact(canaryPolicy).unsuccessful().submit();
    tester.jobCompletion(component).application(default3).nextBuildNumber(2).uploadArtifact(canaryPolicy).unsuccessful().submit();
    tester.updateVersionStatus(version);
    assertEquals(VespaVersion.Confidence.normal, tester.controller().versionStatus().systemVersion().get().confidence());
}
Also used : Version(com.yahoo.component.Version) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) DeploymentTester(com.yahoo.vespa.hosted.controller.deployment.DeploymentTester) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) Application(com.yahoo.vespa.hosted.controller.Application) 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 25 with Version

use of com.yahoo.component.Version in project vespa by vespa-engine.

the class UpgraderTest method testBlockVersionChangeHalfwayThoughThenNewVersion.

/**
 * Tests the scenario where a release is deployed to 2 of 3 production zones, then blocked,
 * followed by timeout of the upgrade and a new release.
 * In this case, the blocked production zone should not progress with upgrading to the previous version,
 * and should not upgrade to the new version until the other production zones have it
 * (expected behavior; both requirements are debatable).
 */
@Test
public void testBlockVersionChangeHalfwayThoughThenNewVersion() {
    // Friday, 16:00
    ManualClock clock = new ManualClock(Instant.parse("2017-09-29T16:00:00.00Z"));
    DeploymentTester tester = new DeploymentTester(new ControllerTester(clock));
    Version version = Version.fromString("5.0");
    tester.updateVersionStatus(version);
    ApplicationPackage applicationPackage = new ApplicationPackageBuilder().upgradePolicy("canary").blockChange(false, true, "mon-fri", "00-09,17-23", "UTC").blockChange(false, true, "sat-sun", "00-23", "UTC").region("us-west-1").region("us-central-1").region("us-east-3").build();
    Application app = tester.createAndDeploy("app1", 1, applicationPackage);
    // New version is released
    version = Version.fromString("5.1");
    tester.updateVersionStatus(version);
    // Application upgrade starts
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    tester.deployAndNotify(app, applicationPackage, true, systemTest);
    tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest);
    tester.deployAndNotify(app, applicationPackage, true, productionUsWest1);
    // Entering block window after prod job is triggered
    clock.advance(Duration.ofHours(1));
    tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsCentral1);
    // Next job not triggered due to being in the block window
    assertTrue(tester.deploymentQueue().jobs().isEmpty());
    // A day passes and we get a new version
    tester.clock().advance(Duration.ofDays(1));
    version = Version.fromString("5.2");
    tester.updateVersionStatus(version);
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    assertTrue("Nothing is scheduled", tester.deploymentQueue().jobs().isEmpty());
    // Monday morning: We are not blocked
    // Sunday, 17:00
    tester.clock().advance(Duration.ofDays(1));
    // Monday, 10:00
    tester.clock().advance(Duration.ofHours(17));
    tester.upgrader().maintain();
    tester.readyJobTrigger().maintain();
    // We proceed with the new version in the expected order, not starting with the previously blocked version:
    // Test jobs are run with the new version, but not production as we are in the block window
    tester.deployAndNotify(app, applicationPackage, true, systemTest);
    tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.stagingTest);
    tester.deployAndNotify(app, applicationPackage, true, productionUsWest1);
    tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsCentral1);
    tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsEast3);
    assertTrue("All jobs consumed", tester.deploymentQueue().jobs().isEmpty());
    // App is completely upgraded to the latest version
    for (Deployment deployment : tester.applications().require(app.id()).deployments().values()) assertEquals(version, deployment.version());
}
Also used : ManualClock(com.yahoo.test.ManualClock) Version(com.yahoo.component.Version) VespaVersion(com.yahoo.vespa.hosted.controller.versions.VespaVersion) DeploymentTester(com.yahoo.vespa.hosted.controller.deployment.DeploymentTester) ApplicationPackageBuilder(com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder) Deployment(com.yahoo.vespa.hosted.controller.application.Deployment) ApplicationPackage(com.yahoo.vespa.hosted.controller.application.ApplicationPackage) Application(com.yahoo.vespa.hosted.controller.Application) ControllerTester(com.yahoo.vespa.hosted.controller.ControllerTester) 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

Version (com.yahoo.component.Version)83 Test (org.junit.Test)46 Application (com.yahoo.vespa.hosted.controller.Application)32 JobType.systemTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.systemTest)30 ApplicationPackage (com.yahoo.vespa.hosted.controller.application.ApplicationPackage)25 JobType.stagingTest (com.yahoo.vespa.hosted.controller.application.DeploymentJobs.JobType.stagingTest)25 DeploymentTester (com.yahoo.vespa.hosted.controller.deployment.DeploymentTester)24 VespaVersion (com.yahoo.vespa.hosted.controller.versions.VespaVersion)22 ApplicationPackageBuilder (com.yahoo.vespa.hosted.controller.deployment.ApplicationPackageBuilder)17 ApplicationVersion (com.yahoo.vespa.hosted.controller.application.ApplicationVersion)15 ApplicationId (com.yahoo.config.provision.ApplicationId)11 Collections (java.util.Collections)11 List (java.util.List)11 Deployment (com.yahoo.vespa.hosted.controller.application.Deployment)10 Optional (java.util.Optional)10 Slime (com.yahoo.slime.Slime)9 Map (java.util.Map)9 ControllerTester (com.yahoo.vespa.hosted.controller.ControllerTester)7 ZoneId (com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId)7 URI (java.net.URI)7