use of com.yahoo.vespa.hosted.controller.Application 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 in project vespa by vespa-engine.
the class FailureRedeployerTest method retryIgnoresStaleJobData.
@Test
public void retryIgnoresStaleJobData() throws Exception {
DeploymentTester tester = new DeploymentTester();
tester.controllerTester().zoneRegistry().setSystem(SystemName.cd);
tester.controllerTester().zoneRegistry().setZones(ZoneId.from("prod", "cd-us-central-1"));
// Current system version, matches version in test data
Version version = Version.fromString("6.141.117");
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/canary-with-stale-data.json"));
Slime slime = SlimeUtils.jsonToSlime(json);
Application application = tester.controllerTester().createApplication(slime);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().upgradePolicy("canary").region("cd-us-central-1").build();
tester.jobCompletion(component).application(application).uploadArtifact(applicationPackage).submit();
// New version is released
version = Version.fromString("6.142.1");
tester.configServer().setDefaultVersion(version);
tester.updateVersionStatus(version);
assertEquals(version, tester.controller().versionStatus().systemVersion().get().versionNumber());
tester.upgrader().maintain();
tester.readyJobTrigger().maintain();
// Test environments pass
tester.deploy(DeploymentJobs.JobType.systemTest, application, applicationPackage);
tester.deploymentQueue().takeJobsToRun();
tester.clock().advance(Duration.ofMinutes(10));
tester.jobCompletion(DeploymentJobs.JobType.systemTest).application(application).submit();
tester.deploy(DeploymentJobs.JobType.stagingTest, application, applicationPackage);
tester.deploymentQueue().takeJobsToRun();
tester.clock().advance(Duration.ofMinutes(10));
tester.jobCompletion(DeploymentJobs.JobType.stagingTest).application(application).submit();
// Production job starts, but does not complete
assertEquals(1, tester.deploymentQueue().jobs().size());
assertEquals("Production job triggered", DeploymentJobs.JobType.productionCdUsCentral1.jobName(), tester.deploymentQueue().jobs().get(0).jobName());
tester.deploymentQueue().takeJobsToRun();
// Failure re-deployer runs
tester.readyJobTrigger().maintain();
assertTrue("No jobs retried", tester.deploymentQueue().jobs().isEmpty());
// Deployment notifies completeness but has not actually made a deployment
tester.jobCompletion(DeploymentJobs.JobType.productionCdUsCentral1).application(application).submit();
assertTrue("Change not really deployed", tester.application(application.id()).change().isPresent());
// Deployment actually deploys and notifies completeness
tester.deploy(DeploymentJobs.JobType.productionCdUsCentral1, application, applicationPackage);
tester.jobCompletion(DeploymentJobs.JobType.productionCdUsCentral1).application(application).submit();
assertFalse("Change not really deployed", tester.application(application.id()).change().isPresent());
}
use of com.yahoo.vespa.hosted.controller.Application in project vespa by vespa-engine.
the class FailureRedeployerTest method ignoresPullRequestInstances.
@Test
public void ignoresPullRequestInstances() throws Exception {
DeploymentTester tester = new DeploymentTester();
tester.controllerTester().zoneRegistry().setSystem(SystemName.cd);
// 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/pr-instance-with-dead-locked-job.json"));
Slime slime = SlimeUtils.jsonToSlime(json);
Application application = tester.controllerTester().createApplication(slime);
// Failure redeployer does not restart deployment
tester.readyJobTrigger().maintain();
assertTrue("No jobs scheduled", tester.deploymentQueue().jobs().isEmpty());
}
use of com.yahoo.vespa.hosted.controller.Application in project vespa by vespa-engine.
the class MetricsReporterTest method test_deployment_fail_ratio.
@Test
public void test_deployment_fail_ratio() {
DeploymentTester tester = new DeploymentTester();
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("us-west-1").build();
MetricsReporter metricsReporter = createReporter(tester.controller(), metrics, SystemName.cd);
metricsReporter.maintain();
assertEquals(0.0, metrics.getMetric(MetricsReporter.deploymentFailMetric));
// Deploy all apps successfully
Application app1 = tester.createApplication("app1", "tenant1", 1, 11L);
Application app2 = tester.createApplication("app2", "tenant1", 2, 22L);
Application app3 = tester.createApplication("app3", "tenant1", 3, 33L);
Application app4 = tester.createApplication("app4", "tenant1", 4, 44L);
tester.deployCompletely(app1, applicationPackage);
tester.deployCompletely(app2, applicationPackage);
tester.deployCompletely(app3, applicationPackage);
tester.deployCompletely(app4, applicationPackage);
metricsReporter.maintain();
assertEquals(0.0, metrics.getMetric(MetricsReporter.deploymentFailMetric));
// 1 app fails system-test
tester.jobCompletion(component).application(app4).nextBuildNumber().uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(app4, applicationPackage, false, systemTest);
metricsReporter.maintain();
assertEquals(25.0, metrics.getMetric(MetricsReporter.deploymentFailMetric));
}
use of com.yahoo.vespa.hosted.controller.Application 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());
}
Aggregations