use of com.yahoo.vespa.hosted.controller.deployment.DeploymentTester in project vespa by vespa-engine.
the class RotationTest method before.
@Before
public void before() {
tester = new DeploymentTester(new ControllerTester(rotationsConfig));
repository = tester.controller().applications().rotationRepository();
application = tester.createApplication("app1", "tenant1", 11L, 1L);
}
use of com.yahoo.vespa.hosted.controller.deployment.DeploymentTester in project vespa by vespa-engine.
the class RotationTest method strips_whitespace_in_rotation_fqdn.
@Test
public void strips_whitespace_in_rotation_fqdn() {
DeploymentTester tester = new DeploymentTester(new ControllerTester(rotationsConfigWhitespaces));
RotationRepository repository = tester.controller().applications().rotationRepository();
Application application = tester.createApplication("app2", "tenant2", 22L, 2L);
tester.deployCompletely(application, applicationPackage);
application = tester.applications().require(application.id());
try (RotationLock lock = repository.lock()) {
Rotation rotation = repository.getRotation(application, lock);
Rotation assignedRotation = new Rotation(new RotationId("foo-1"), "foo-1.com");
assertEquals(assignedRotation, rotation);
}
}
use of com.yahoo.vespa.hosted.controller.deployment.DeploymentTester in project vespa by vespa-engine.
the class ControllerTest method requeueOutOfCapacityStagingJob.
@Test
public void requeueOutOfCapacityStagingJob() {
DeploymentTester tester = new DeploymentTester();
long project1 = 1;
long project2 = 2;
long project3 = 3;
Application app1 = tester.createApplication("app1", "tenant1", project1, 1L);
Application app2 = tester.createApplication("app2", "tenant2", project2, 1L);
Application app3 = tester.createApplication("app3", "tenant3", project3, 1L);
DeploymentQueue deploymentQueue = tester.controller().applications().deploymentTrigger().deploymentQueue();
// all applications: system-test completes successfully
tester.jobCompletion(component).application(app1).uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(app1, applicationPackage, true, systemTest);
tester.jobCompletion(component).application(app2).uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(app2, applicationPackage, true, systemTest);
tester.jobCompletion(component).application(app3).uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(app3, applicationPackage, true, systemTest);
// all applications: staging test jobs queued
assertEquals(3, deploymentQueue.jobs().size());
// app1: staging-test job fails with out of capacity and is added to the front of the queue
tester.deploy(stagingTest, app1, applicationPackage);
tester.jobCompletion(stagingTest).application(app1).error(JobError.outOfCapacity).submit();
assertEquals(stagingTest.jobName(), deploymentQueue.jobs().get(0).jobName());
assertEquals(project1, deploymentQueue.jobs().get(0).projectId());
// app2 and app3: Completes deployment
tester.deployAndNotify(app2, applicationPackage, true, stagingTest);
tester.deployAndNotify(app2, applicationPackage, true, productionCorpUsEast1);
tester.deployAndNotify(app3, applicationPackage, true, stagingTest);
tester.deployAndNotify(app3, applicationPackage, true, productionCorpUsEast1);
// app2 and app3: New change triggers system-test jobs
// Provide a changed application package, too, or the deployment is a no-op.
tester.jobCompletion(component).application(app2).nextBuildNumber().uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(app2, applicationPackage2, true, systemTest);
tester.jobCompletion(component).application(app3).nextBuildNumber().uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(app3, applicationPackage2, true, systemTest);
assertEquals(Collections.singletonList(new BuildService.BuildJob(project1, stagingTest.jobName())), deploymentQueue.takeJobsToRun());
assertEquals(Collections.singletonList(new BuildService.BuildJob(project2, stagingTest.jobName())), deploymentQueue.takeJobsToRun());
assertEquals(Collections.singletonList(new BuildService.BuildJob(project3, stagingTest.jobName())), deploymentQueue.takeJobsToRun());
assertEquals(Collections.emptyList(), deploymentQueue.takeJobsToRun());
}
use of com.yahoo.vespa.hosted.controller.deployment.DeploymentTester in project vespa by vespa-engine.
the class VersionStatusTest method testVersionConfidence.
@Test
public void testVersionConfidence() {
DeploymentTester tester = new DeploymentTester();
Version version0 = new Version("5.0");
tester.upgradeSystem(version0);
// Setup applications - all running on version0
Application canary0 = tester.createAndDeploy("canary0", 1, "canary");
Application canary1 = tester.createAndDeploy("canary1", 2, "canary");
Application canary2 = tester.createAndDeploy("canary2", 3, "canary");
Application default0 = tester.createAndDeploy("default0", 4, "default");
Application default1 = tester.createAndDeploy("default1", 5, "default");
Application default2 = tester.createAndDeploy("default2", 6, "default");
Application default3 = tester.createAndDeploy("default3", 7, "default");
Application default4 = tester.createAndDeploy("default4", 8, "default");
Application default5 = tester.createAndDeploy("default5", 9, "default");
Application default6 = tester.createAndDeploy("default6", 10, "default");
Application default7 = tester.createAndDeploy("default7", 11, "default");
Application default8 = tester.createAndDeploy("default8", 12, "default");
Application default9 = tester.createAndDeploy("default9", 13, "default");
Application conservative0 = tester.createAndDeploy("conservative1", 14, "conservative");
// Applications that do not affect confidence calculation:
// Application without deployment
Application ignored0 = tester.createApplication("ignored0", "tenant1", 1000, 1000L);
// Pull request builds
tester.controllerTester().createApplication(new TenantId("tenant1"), "ignored1", "43", 1000);
assertEquals("All applications running on this version: High", Confidence.high, confidence(tester.controller(), version0));
// New version is released
Version version1 = new Version("5.1");
tester.upgradeSystem(version1);
// Canaries upgrade to new versions and fail
tester.completeUpgrade(canary0, version1, "canary");
tester.completeUpgradeWithError(canary1, version1, "canary", productionUsWest1);
tester.updateVersionStatus();
assertEquals("One canary failed: Broken", Confidence.broken, confidence(tester.controller(), version1));
// New version is released
Version version2 = new Version("5.2");
tester.upgradeSystem(version2);
assertEquals("Confidence defaults to low for version with no applications", Confidence.low, confidence(tester.controller(), version2));
// All canaries upgrade successfully
tester.completeUpgrade(canary0, version2, "canary");
tester.jobCompletion(productionUsWest1).application(canary1).unsuccessful().submit();
tester.completeUpgrade(canary1, version2, "canary");
assertEquals("Confidence for remains unchanged for version1: Broken", Confidence.broken, confidence(tester.controller(), version1));
assertEquals("Nothing has failed but not all canaries have upgraded: Low", Confidence.low, confidence(tester.controller(), version2));
// Remaining canary upgrades to version2 which raises confidence to normal and more apps upgrade
tester.jobCompletion(systemTest).application(canary2).unsuccessful().submit();
tester.completeUpgrade(canary2, version2, "canary");
tester.upgradeSystem(version2);
assertEquals("Canaries have upgraded: Normal", Confidence.normal, confidence(tester.controller(), version2));
tester.completeUpgrade(default0, version2, "default");
tester.completeUpgrade(default1, version2, "default");
tester.completeUpgrade(default2, version2, "default");
tester.completeUpgrade(default3, version2, "default");
tester.completeUpgrade(default4, version2, "default");
tester.completeUpgrade(default5, version2, "default");
tester.completeUpgrade(default6, version2, "default");
tester.completeUpgrade(default7, version2, "default");
tester.updateVersionStatus();
// Remember confidence across restart
tester.restartController();
assertEquals("Confidence remains unchanged for version0: High", Confidence.high, confidence(tester.controller(), version0));
assertEquals("All canaries deployed + < 90% of defaults: Normal", Confidence.normal, confidence(tester.controller(), version2));
assertTrue("Status for version without applications is removed", tester.controller().versionStatus().versions().stream().noneMatch(vespaVersion -> vespaVersion.versionNumber().equals(version1)));
// Another default application upgrades, raising confidence to high
tester.completeUpgrade(default8, version2, "default");
tester.completeUpgrade(default9, version2, "default");
tester.updateVersionStatus();
assertEquals("Confidence remains unchanged for version0: High", Confidence.high, confidence(tester.controller(), version0));
assertEquals("90% of defaults deployed successfully: High", VespaVersion.Confidence.high, confidence(tester.controller(), version2));
// A new version is released, all canaries upgrade successfully, but enough "default" apps fail to mark version
// as broken
Version version3 = new Version("5.3");
tester.upgradeSystem(version3);
tester.completeUpgrade(canary0, version3, "canary");
tester.completeUpgrade(canary1, version3, "canary");
tester.completeUpgrade(canary2, version3, "canary");
tester.upgradeSystem(version3);
tester.completeUpgradeWithError(default0, version3, "default", stagingTest);
tester.completeUpgradeWithError(default1, version3, "default", stagingTest);
tester.completeUpgradeWithError(default2, version3, "default", stagingTest);
tester.completeUpgradeWithError(default9, version3, "default", stagingTest);
tester.updateVersionStatus();
assertEquals("Confidence remains unchanged for version0: High", Confidence.high, confidence(tester.controller(), version0));
assertEquals("Confidence remains unchanged for version2: High", Confidence.high, confidence(tester.controller(), version2));
assertEquals("40% of defaults failed: Broken", VespaVersion.Confidence.broken, confidence(tester.controller(), version3));
// Test version order
List<VespaVersion> versions = tester.controller().versionStatus().versions();
assertEquals(3, versions.size());
assertEquals("5", versions.get(0).versionNumber().toString());
assertEquals("5.2", versions.get(1).versionNumber().toString());
assertEquals("5.3", versions.get(2).versionNumber().toString());
}
use of com.yahoo.vespa.hosted.controller.deployment.DeploymentTester in project vespa by vespa-engine.
the class ApplicationOwnershipConfirmerTest method setup.
@Before
public void setup() {
tester = new DeploymentTester();
issues = new MockOwnershipIssues();
confirmer = new ApplicationOwnershipConfirmer(tester.controller(), Duration.ofDays(1), new JobControl(new MockCuratorDb()), issues);
}
Aggregations