use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.
the class DeploymentTriggerTest method dualChangesAreNotSkippedWhenOnePartIsDeployedAlready.
@Test
public void dualChangesAreNotSkippedWhenOnePartIsDeployedAlready() {
DeploymentTester tester = new DeploymentTester();
Application application = tester.createApplication("app1", "tenant1", 1, 1L);
Supplier<Application> app = () -> tester.application(application.id());
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("us-central-1").region("eu-west-1").build();
tester.deployCompletely(application, applicationPackage);
// Platform upgrade which doesn't succeed, allowing a dual change.
Version version1 = new Version("7.1");
tester.upgradeSystem(version1);
tester.completeUpgradeWithError(application, version1, applicationPackage, productionEuWest1);
// Deploy the new application version, even though the platform version is already deployed in us-central-1.
// Let it fail in us-central-1 after deployment, so we can test this zone is later skipped.
tester.jobCompletion(component).application(application).nextBuildNumber().uploadArtifact(applicationPackage).submit();
tester.deployAndNotify(application, applicationPackage, true, false, systemTest);
tester.deployAndNotify(application, applicationPackage, true, false, stagingTest);
tester.jobCompletion(productionEuWest1).application(application).unsuccessful().submit();
tester.deploy(productionUsCentral1, application, Optional.empty(), false);
// Deploying before notifying here makes the job not re-trigger, but instead triggers the next job (because of triggerReadyJobs() in notification.)
tester.deployAndNotify(application, applicationPackage, false, productionUsCentral1);
assertEquals(ApplicationVersion.from(BuildJob.defaultSourceRevision, BuildJob.defaultBuildNumber + 1), app.get().deployments().get(ZoneId.from("prod.us-central-1")).applicationVersion());
assertEquals(Collections.singletonList(new BuildService.BuildJob(1, productionEuWest1.jobName())), tester.deploymentQueue().jobs());
tester.deploy(productionEuWest1, application, Optional.empty(), false);
tester.deployAndNotify(application, Optional.empty(), false, true, productionEuWest1);
assertFalse(app.get().change().isPresent());
assertTrue(tester.deploymentQueue().jobs().isEmpty());
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.
the class ControllerTest method runDeployment.
private void runDeployment(DeploymentTester tester, ApplicationId application, ApplicationVersion version, ApplicationPackage applicationPackage, SourceRevision sourceRevision, long buildNumber) {
Application app = tester.applications().require(application);
tester.jobCompletion(component).application(app).buildNumber(buildNumber).sourceRevision(sourceRevision).uploadArtifact(applicationPackage).submit();
ApplicationVersion change = ApplicationVersion.from(sourceRevision, buildNumber);
assertEquals(change.id(), tester.controller().applications().require(application).change().application().get().id());
runDeployment(tester, app, version, Optional.empty(), Optional.of(applicationPackage));
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.
the class ControllerTest method runUpgrade.
private void runUpgrade(DeploymentTester tester, ApplicationId application, ApplicationVersion version) {
Version next = Version.fromString("6.2");
tester.upgradeSystem(next);
runDeployment(tester, tester.applications().require(application), version, Optional.of(next), Optional.empty());
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.
the class ControllerTest method runDeployment.
private void runDeployment(DeploymentTester tester, Application app, ApplicationVersion version, Optional<Version> upgrade, Optional<ApplicationPackage> applicationPackage) {
Version vespaVersion = upgrade.orElseGet(tester::defaultVespaVersion);
// Deploy in test
tester.deployAndNotify(app, applicationPackage, true, true, systemTest);
tester.deployAndNotify(app, applicationPackage, true, true, stagingTest);
assertStatus(JobStatus.initial(stagingTest).withTriggering(vespaVersion, version, "", tester.clock().instant().minus(Duration.ofMillis(1))).withCompletion(42, Optional.empty(), tester.clock().instant(), tester.controller()), app.id(), tester.controller());
// Deploy in production
tester.deployAndNotify(app, applicationPackage, true, true, productionCorpUsEast1);
assertStatus(JobStatus.initial(productionCorpUsEast1).withTriggering(vespaVersion, version, "", tester.clock().instant().minus(Duration.ofMillis(1))).withCompletion(42, Optional.empty(), tester.clock().instant(), tester.controller()), app.id(), tester.controller());
tester.deployAndNotify(app, applicationPackage, true, true, productionUsEast3);
assertStatus(JobStatus.initial(productionUsEast3).withTriggering(vespaVersion, version, "", tester.clock().instant().minus(Duration.ofMillis(1))).withCompletion(42, Optional.empty(), tester.clock().instant(), tester.controller()), app.id(), tester.controller());
// Verify deployed version
app = tester.controller().applications().require(app.id());
for (Deployment deployment : app.productionDeployments().values()) {
assertEquals(version, deployment.applicationVersion());
upgrade.ifPresent(v -> assertEquals(v, deployment.version()));
}
}
use of com.yahoo.vespa.hosted.controller.application.ApplicationVersion in project vespa by vespa-engine.
the class ControllerTest method testDeploymentApplicationVersion.
@Test
public void testDeploymentApplicationVersion() {
DeploymentTester tester = new DeploymentTester();
Application app = tester.createApplication("app1", "tenant1", 1, 11L);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder().environment(Environment.prod).region("corp-us-east-1").region("us-east-3").build();
SourceRevision source = new SourceRevision("repo", "master", "commit1");
ApplicationVersion applicationVersion = ApplicationVersion.from(source, 101);
runDeployment(tester, app.id(), applicationVersion, applicationPackage, source, 101);
assertEquals("Artifact is downloaded twice in staging and once for other zones", 5, tester.artifactRepository().hits(app.id(), applicationVersion.id()));
// Application is upgraded. This makes deployment orchestration pick the last successful application version in
// zones which do not have permanent deployments, e.g. test and staging
runUpgrade(tester, app.id(), applicationVersion);
}
Aggregations