diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-01-26 17:48:09 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-01-26 17:48:09 +0100 |
commit | 4960b4aa3628d9430ffba24e238d1b2063f4a950 (patch) | |
tree | a5c4260fb6136e5fd18fba0bbd9d77156e623b85 | |
parent | 9a80de2c6eb7fe06add018b76b7631b046b9c92b (diff) |
Application.deploying -> Application.change
16 files changed, 97 insertions, 97 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java index e47f5519fae..ff8d817ca52 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java @@ -41,7 +41,7 @@ public class Application { private final ValidationOverrides validationOverrides; private final Map<ZoneId, Deployment> deployments; private final DeploymentJobs deploymentJobs; - private final Change deploying; + private final Change change; private final boolean outstandingChange; private final Optional<IssueId> ownershipIssueId; private final ApplicationMetrics metrics; @@ -57,16 +57,16 @@ public class Application { /** Used from persistence layer: Do not use */ public Application(ApplicationId id, DeploymentSpec deploymentSpec, ValidationOverrides validationOverrides, - List<Deployment> deployments, DeploymentJobs deploymentJobs, Change deploying, + List<Deployment> deployments, DeploymentJobs deploymentJobs, Change change, boolean outstandingChange, Optional<IssueId> ownershipIssueId, ApplicationMetrics metrics, Optional<RotationId> rotation) { this(id, deploymentSpec, validationOverrides, deployments.stream().collect(Collectors.toMap(Deployment::zone, d -> d)), - deploymentJobs, deploying, outstandingChange, ownershipIssueId, metrics, rotation); + deploymentJobs, change, outstandingChange, ownershipIssueId, metrics, rotation); } Application(ApplicationId id, DeploymentSpec deploymentSpec, ValidationOverrides validationOverrides, - Map<ZoneId, Deployment> deployments, DeploymentJobs deploymentJobs, Change deploying, + Map<ZoneId, Deployment> deployments, DeploymentJobs deploymentJobs, Change change, boolean outstandingChange, Optional<IssueId> ownershipIssueId, ApplicationMetrics metrics, Optional<RotationId> rotation) { Objects.requireNonNull(id, "id cannot be null"); @@ -74,7 +74,7 @@ public class Application { Objects.requireNonNull(validationOverrides, "validationOverrides cannot be null"); Objects.requireNonNull(deployments, "deployments cannot be null"); Objects.requireNonNull(deploymentJobs, "deploymentJobs cannot be null"); - Objects.requireNonNull(deploying, "deploying cannot be null"); + Objects.requireNonNull(change, "deploying cannot be null"); Objects.requireNonNull(metrics, "metrics cannot be null"); Objects.requireNonNull(rotation, "rotation cannot be null"); this.id = id; @@ -82,7 +82,7 @@ public class Application { this.validationOverrides = validationOverrides; this.deployments = ImmutableMap.copyOf(deployments); this.deploymentJobs = deploymentJobs; - this.deploying = deploying; + this.change = change; this.outstandingChange = outstandingChange; this.ownershipIssueId = ownershipIssueId; this.metrics = metrics; @@ -120,10 +120,10 @@ public class Application { public DeploymentJobs deploymentJobs() { return deploymentJobs; } /** - * Returns the change that is currently in the process of being deployed on this application, - * or empty if no change is currently being deployed. + * Returns the change that should currently be deployed for this application, + * which is empty when no change is in progress. */ - public Change deploying() { return deploying; } + public Change change() { return change; } /** * Returns whether this has an outstanding change (in the source repository), which @@ -151,7 +151,7 @@ public class Application { /** Returns the version a new deployment to this zone should use for this application */ public Version deployVersionIn(ZoneId zone, Controller controller) { - return deploying.platform().orElse(versionIn(zone, controller)); + return change.platform().orElse(versionIn(zone, controller)); } /** Returns the current version this application has, or if none; should use, in the given zone */ @@ -162,8 +162,8 @@ public class Application { /** Returns the application version a deployment to this zone should use, or empty if we don't know */ public Optional<ApplicationVersion> deployApplicationVersionIn(ZoneId zone) { - if (deploying().application().isPresent()) { - ApplicationVersion version = deploying().application().get(); + if (change().application().isPresent()) { + ApplicationVersion version = change().application().get(); if (version == ApplicationVersion.unknown) return Optional.empty(); else diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java index fed70b8d175..83c3d6a5d11 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java @@ -291,7 +291,7 @@ public class ApplicationController { version = application.versionIn(zone, controller); } else if (canDeployDirectlyTo(zone, options)) { version = options.vespaVersion.map(Version::new).orElse(controller.systemVersion()); - } else if ( ! application.deploying().isPresent() && ! zone.environment().isManuallyDeployed()) { + } else if (! application.change().isPresent() && ! zone.environment().isManuallyDeployed()) { return unexpectedDeployment(applicationId, zone, applicationPackageFromDeployer); } else { version = application.deployVersionIn(zone, controller); @@ -322,8 +322,8 @@ public class ApplicationController { // TODO: Remove after introducing new application version number if ( ! options.deployCurrentVersion && applicationPackageFromDeployer.isPresent()) { - if (application.deploying().application().isPresent()) { - application = application.withDeploying(application.deploying().with(applicationVersion)); + if (application.change().application().isPresent()) { + application = application.withDeploying(application.change().with(applicationVersion)); } if (!canDeployDirectlyTo(zone, options) && jobType.isPresent()) { // Update with (potentially) missing information about what we triggered: @@ -332,7 +332,7 @@ public class ApplicationController { // for future use. JobStatus.JobRun triggering = getOrCreateTriggering(application, version, jobType.get()); application = application.withJobTriggering(jobType.get(), - application.deploying(), + application.change(), triggering.at(), version, applicationVersion, @@ -358,9 +358,9 @@ public class ApplicationController { // Validate automated deployment if (!canDeployDirectlyTo(zone, options)) { - if (!application.deploymentJobs().isDeployableTo(zone.environment(), application.deploying())) { + if (!application.deploymentJobs().isDeployableTo(zone.environment(), application.change())) { throw new IllegalArgumentException("Rejecting deployment of " + application + " to " + zone + - " as " + application.deploying() + " is not tested"); + " as " + application.change() + " is not tested"); } Deployment existingDeployment = application.deployments().get(zone); if (zone.environment().isProduction() && existingDeployment != null && diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java index 9dd849d736a..e744df0da68 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java @@ -178,7 +178,7 @@ public class LockedApplication extends Application { this.validationOverrides = application.validationOverrides(); this.deployments = application.deployments(); this.deploymentJobs = application.deploymentJobs(); - this.deploying = application.deploying(); + this.deploying = application.change(); this.hasOutstandingChange = application.hasOutstandingChange(); this.ownershipIssueId = application.ownershipIssueId(); this.metrics = application.metrics(); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java index fe085a6bfa4..777cb4011b6 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java @@ -54,7 +54,7 @@ public class ApplicationList { /** Returns the subset of applications which are currently upgrading (to any version) */ public ApplicationList upgrading() { - return listOf(list.stream().filter(application -> application.deploying().platform().isPresent())); + return listOf(list.stream().filter(application -> application.change().platform().isPresent())); } /** Returns the subset of applications which are currently upgrading to the given version */ @@ -78,7 +78,7 @@ public class ApplicationList { /** Returns the subset of applications which is currently not deploying a change */ public ApplicationList notDeploying() { - return listOf(list.stream().filter(application -> ! application.deploying().isPresent())); + return listOf(list.stream().filter(application -> ! application.change().isPresent())); } /** Returns the subset of applications which currently does not have any failing jobs */ @@ -171,7 +171,7 @@ public class ApplicationList { // ----------------------------------- Internal helpers private static boolean isUpgradingTo(Version version, Application application) { - return application.deploying().platform().equals(Optional.of(version)); + return application.change().platform().equals(Optional.of(version)); } private static boolean failingOn(Version version, Application application) { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java index d506e8f3dcd..66bb05df308 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java @@ -46,7 +46,7 @@ public class DeploymentOrder { /** Returns a list of jobs to trigger after the given job */ // TODO: This does too much - should just tell us the order, as advertised public List<JobType> nextAfter(JobType job, LockedApplication application) { - if ( ! application.deploying().isPresent()) { // Change was cancelled + if ( ! application.change().isPresent()) { // Change was cancelled return Collections.emptyList(); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java index 10e0747979d..1beab1307c1 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java @@ -86,7 +86,7 @@ public class DeploymentTrigger { if (report.jobType() == JobType.component) { if (acceptNewApplicationVersionNow(application)) { // Set this as the change we are doing, unless we are already pushing a platform change - if ( ! ( application.deploying().platform().isPresent())) { + if ( ! ( application.change().platform().isPresent())) { ApplicationVersion applicationVersion = ApplicationVersion.unknown; if (report.sourceRevision().isPresent()) applicationVersion = ApplicationVersion.from(report.sourceRevision().get(), report.buildNumber()); @@ -121,8 +121,8 @@ public class DeploymentTrigger { /** Returns whether all production zones listed in deployment spec has this change (or a newer version, if upgrade) */ private boolean deploymentComplete(LockedApplication application) { - if ( ! application.deploying().isPresent()) return true; - Change change = application.deploying(); + if ( ! application.change().isPresent()) return true; + Change change = application.change(); for (JobType job : order.jobsFrom(application.deploymentSpec())) { if ( ! job.isProduction()) continue; @@ -158,14 +158,14 @@ public class DeploymentTrigger { /** Find the next step to trigger if any, and triggers it */ public void triggerReadyJobs(LockedApplication application) { - if ( ! application.deploying().isPresent()) return; + if ( ! application.change().isPresent()) return; List<JobType> jobs = order.jobsFrom(application.deploymentSpec()); // Should the first step be triggered? if ( ! jobs.isEmpty() && jobs.get(0).equals(JobType.systemTest) ) { JobStatus systemTestStatus = application.deploymentJobs().jobStatus().get(JobType.systemTest); - if (application.deploying().platform().isPresent()) { - Version target = application.deploying().platform().get(); + if (application.change().platform().isPresent()) { + Version target = application.change().platform().get(); if (systemTestStatus == null || ! systemTestStatus.lastTriggered().isPresent() || ! systemTestStatus.isSuccess() @@ -208,11 +208,11 @@ public class DeploymentTrigger { * which is newer (different) than the one last completed successfully in next */ private boolean changesAvailable(Application application, JobStatus previous, JobStatus next) { - if ( ! application.deploying().isPresent()) return false; + if ( ! application.change().isPresent()) return false; if (next == null) return true; - if (application.deploying().platform().isPresent()) { // Propagate upgrade while making sure we never downgrade - Version targetVersion = application.deploying().platform().get(); + if (application.change().platform().isPresent()) { // Propagate upgrade while making sure we never downgrade + Version targetVersion = application.change().platform().get(); if (next.type().isTest()) { // Is it not yet this job's turn to upgrade? @@ -257,9 +257,9 @@ public class DeploymentTrigger { */ public void triggerChange(ApplicationId applicationId, Change change) { applications().lockOrThrow(applicationId, application -> { - if (application.deploying().isPresent() && ! application.deploymentJobs().hasFailures()) + if (application.change().isPresent() && ! application.deploymentJobs().hasFailures()) throw new IllegalArgumentException("Could not start " + change + " on " + application + ": " + - application.deploying() + " is already in progress"); + application.change() + " is already in progress"); application = application.withDeploying(change); if (change.application().isPresent()) application = application.withOutstandingChange(false); @@ -340,7 +340,7 @@ public class DeploymentTrigger { if (jobType == null) return application; // we are passed null when the last job has been reached // Never allow untested changes to go through // Note that this may happen because a new change catches up and prevents an older one from continuing - if ( ! application.deploymentJobs().isDeployableTo(jobType.environment(), application.deploying())) { + if ( ! application.deploymentJobs().isDeployableTo(jobType.environment(), application.change())) { log.warning(String.format("Want to trigger %s for %s with reason %s, but change is untested", jobType, application, reason)); return application; @@ -348,11 +348,11 @@ public class DeploymentTrigger { if ( ! force && ! allowedTriggering(jobType, application)) return application; log.info(String.format("Triggering %s for %s, %s: %s", jobType, application, - application.deploying().isPresent() ? "deploying " + application.deploying() : "restarted deployment", + application.change().isPresent() ? "deploying " + application.change() : "restarted deployment", reason)); buildSystem.addJob(application.id(), jobType, first); return application.withJobTriggering(jobType, - application.deploying(), + application.change(), clock.instant(), application.deployVersionFor(jobType, controller), application.deployApplicationVersion(jobType, controller).orElse(ApplicationVersion.unknown), @@ -366,12 +366,12 @@ public class DeploymentTrigger { // this leads to some additional corner cases, and the possibility of blocking an application // fix to a version upgrade, so not doing it now - if (jobType.isProduction() && application.deploying().isPresent() && - application.deploying().blockedBy(application.deploymentSpec(), clock.instant())) return false; + if (jobType.isProduction() && application.change().isPresent() && + application.change().blockedBy(application.deploymentSpec(), clock.instant())) return false; // Don't downgrade or redeploy the same version in production needlessly - if (application.deploying().platform().isPresent() && - jobType.isProduction() && alreadyDeployed((application.deploying().platform().get()), application, jobType)) return false; + if (application.change().platform().isPresent() && + jobType.isProduction() && alreadyDeployed((application.change().platform().get()), application, jobType)) return false; if (application.deploymentJobs().isRunning(jobType, jobTimeoutLimit())) return false; if ( ! hasJob(jobType, application)) return false; @@ -405,9 +405,9 @@ public class DeploymentTrigger { } private boolean acceptNewApplicationVersionNow(LockedApplication application) { - if ( ! application.deploying().isPresent()) return true; + if ( ! application.change().isPresent()) return true; - if (application.deploying().application().isPresent()) return true; // more application changes are ok + if (application.change().application().isPresent()) return true; // more application changes are ok if (application.deploymentJobs().hasFailures()) return true; // allow changes to fix upgrade problems diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployer.java index 0752b90eca9..3dd63a511e1 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployer.java @@ -24,7 +24,7 @@ public class OutstandingChangeDeployer extends Maintainer { protected void maintain() { ApplicationList applications = ApplicationList.from(controller().applications().asList()).notPullRequest(); for (Application application : applications.asList()) { - if (application.hasOutstandingChange() && ! application.deploying().isPresent()) + if (application.hasOutstandingChange() && ! application.change().isPresent()) controller().applications().deploymentTrigger().triggerChange(application.id(), Change.of(ApplicationVersion.unknown)); } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java index 41641a59363..652f95a2d13 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java @@ -125,7 +125,7 @@ public class ApplicationSerializer { root.setString(validationOverridesField, application.validationOverrides().xmlForm()); deploymentsToSlime(application.deployments().values(), root.setArray(deploymentsField)); toSlime(application.deploymentJobs(), root.setObject(deploymentJobsField)); - toSlime(application.deploying(), root); + toSlime(application.change(), root); root.setBool(outstandingChangeField, application.hasOutstandingChange()); application.ownershipIssueId().ifPresent(issueId -> root.setString(ownershipIssueIdField, issueId.value())); root.setDouble(queryQualityField, application.metrics().queryServiceQuality()); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index c262782ae37..9b2174b881d 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -348,10 +348,10 @@ public class ApplicationApiHandler extends LoggingRequestHandler { object.setString("application", application.id().application().value()); object.setString("instance", application.id().instance().value()); // Currently deploying change - if (application.deploying().isPresent()) { + if (application.change().isPresent()) { Cursor deployingObject = object.setObject("deploying"); - application.deploying().platform().ifPresent(v -> deployingObject.setString("version", v.toString())); - application.deploying().application() + application.change().platform().ifPresent(v -> deployingObject.setString("version", v.toString())); + application.change().application() .filter(v -> v != ApplicationVersion.unknown) .ifPresent(v -> toSlime(v, deployingObject.setObject("revision"))); } @@ -711,9 +711,9 @@ public class ApplicationApiHandler extends LoggingRequestHandler { ApplicationId id = ApplicationId.from(tenantName, applicationName, "default"); controller.applications().lockOrThrow(id, application -> { - if (application.deploying().isPresent()) + if (application.change().isPresent()) throw new IllegalArgumentException("Can not start a deployment of " + application + " at this time: " + - application.deploying() + " is in progress"); + application.change() + " is in progress"); controller.applications().deploymentTrigger().triggerChange(application.id(), Change.of(version)); }); @@ -724,7 +724,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private HttpResponse cancelDeploy(String tenantName, String applicationName) { ApplicationId id = ApplicationId.from(tenantName, applicationName, "default"); Application application = controller.applications().require(id); - Change change = application.deploying(); + Change change = application.change(); if ( ! change.isPresent()) return new MessageResponse("No deployment in progress for " + application + " at this time"); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java index 8d3fe4dbbfc..8d03b4f7121 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java @@ -103,12 +103,12 @@ public class ControllerTest { tester.notifyJobCompletion(component, app1, true); assertEquals("Application version is currently not known", ApplicationVersion.unknown, - tester.controller().applications().require(app1.id()).deploying().application().get()); + tester.controller().applications().require(app1.id()).change().application().get()); tester.deployAndNotify(app1, applicationPackage, true, systemTest); tester.deployAndNotify(app1, applicationPackage, true, stagingTest); assertEquals(4, applications.require(app1.id()).deploymentJobs().jobStatus().size()); - ApplicationVersion applicationVersion = tester.controller().applications().require(app1.id()).deploying().application().get(); + ApplicationVersion applicationVersion = tester.controller().applications().require(app1.id()).change().application().get(); assertTrue("Application version has been set during deployment", applicationVersion != ApplicationVersion.unknown); assertStatus(JobStatus.initial(stagingTest) .withTriggering(version1, applicationVersion, false, "", tester.clock().instant().minus(Duration.ofMillis(1))) @@ -223,7 +223,7 @@ public class ControllerTest { ApplicationVersion expectedVersion = ApplicationVersion.from(source, 37); assertEquals(expectedVersionString, tester.controller().applications() .require(app1.id()) - .deploying().application().get().id()); + .change().application().get().id()); // Deploy without application package tester.deployAndNotify(app1, true, systemTest); @@ -377,7 +377,7 @@ public class ControllerTest { app1 = applications.require(app1.id()); assertEquals("Application change preserves version", systemVersion, app1.oldestDeployedVersion().get()); assertEquals(systemVersion, tester.configServer().lastPrepareVersion().get()); - assertFalse("Change deployed", app1.deploying().isPresent()); + assertFalse("Change deployed", app1.change().isPresent()); // Version upgrade changes system version applications.deploymentTrigger().triggerChange(app1.id(), Change.of(newSystemVersion)); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java index dc8bd3e6423..d0dfe825558 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java @@ -148,7 +148,7 @@ public class DeploymentTester { /** Deploy application completely using the given application package */ public void deployCompletely(Application application, ApplicationPackage applicationPackage) { notifyJobCompletion(JobType.component, application, true); - assertTrue(applications().require(application.id()).deploying().isPresent()); + assertTrue(applications().require(application.id()).change().isPresent()); completeDeployment(application, applicationPackage, Optional.empty(), true); } @@ -172,7 +172,7 @@ public class DeploymentTester { /** Deploy application using the given application package, but expecting to stop after test phases */ public void deployTestOnly(Application application, ApplicationPackage applicationPackage) { notifyJobCompletion(JobType.component, application, true); - assertTrue(applications().require(application.id()).deploying().isPresent()); + assertTrue(applications().require(application.id()).change().isPresent()); completeDeployment(application, applicationPackage, Optional.empty(), false); } @@ -190,13 +190,13 @@ public class DeploymentTester { } } if (failOnJob.isPresent()) { - assertTrue(applications().require(application.id()).deploying().isPresent()); + assertTrue(applications().require(application.id()).change().isPresent()); assertTrue(applications().require(application.id()).deploymentJobs().hasFailures()); } else if (includingProductionZones) { - assertFalse(applications().require(application.id()).deploying().isPresent()); + assertFalse(applications().require(application.id()).change().isPresent()); } else { - assertTrue(applications().require(application.id()).deploying().isPresent()); + assertTrue(applications().require(application.id()).change().isPresent()); } } @@ -219,8 +219,8 @@ public class DeploymentTester { } public void completeUpgrade(Application application, Version version, ApplicationPackage applicationPackage) { - assertTrue(application + " has a deployment", applications().require(application.id()).deploying().isPresent()); - assertEquals(Change.of(version), applications().require(application.id()).deploying()); + assertTrue(application + " has a deployment", applications().require(application.id()).change().isPresent()); + assertEquals(Change.of(version), applications().require(application.id()).change()); completeDeployment(application, applicationPackage, Optional.empty(), true); } @@ -233,8 +233,8 @@ public class DeploymentTester { } private void completeUpgradeWithError(Application application, Version version, ApplicationPackage applicationPackage, Optional<JobType> failOnJob) { - assertTrue(applications().require(application.id()).deploying().isPresent()); - assertEquals(Change.of(version), applications().require(application.id()).deploying()); + assertTrue(applications().require(application.id()).change().isPresent()); + assertEquals(Change.of(version), applications().require(application.id()).change()); completeDeployment(application, applicationPackage, failOnJob, true); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java index 73c6f1c1126..5c61e43f9cf 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java @@ -220,13 +220,13 @@ public class DeploymentTriggerTest { tester.deploy(DeploymentJobs.JobType.productionUsWest1, app, applicationPackage); tester.notifyJobCompletion(DeploymentJobs.JobType.productionUsWest1, app, true); assertTrue("Change is present as not all jobs are complete", - tester.applications().require(app.id()).deploying().isPresent()); + tester.applications().require(app.id()).change().isPresent()); // All jobs complete tester.deploy(DeploymentJobs.JobType.productionUsEast3, app, applicationPackage); tester.notifyJobCompletion(DeploymentJobs.JobType.productionUsEast3, app, true); assertFalse("Change has been deployed", - tester.applications().require(app.id()).deploying().isPresent()); + tester.applications().require(app.id()).change().isPresent()); } @Test @@ -349,7 +349,7 @@ public class DeploymentTriggerTest { // Extra notification for last job tester.notifyJobCompletion(JobType.productionCorpUsEast1, application, true); assertFalse("Change has been deployed", - tester.applications().require(application.id()).deploying().isPresent()); + tester.applications().require(application.id()).change().isPresent()); assertTrue("All jobs consumed", buildSystem.jobs().isEmpty()); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java index b89fcec11a5..11e85c6be9f 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/FailureRedeployerTest.java @@ -58,7 +58,7 @@ public class FailureRedeployerTest { tester.clock().advance(Duration.ofSeconds(1)); // Advance time so that we can detect jobs in progress tester.deployAndNotify(app, applicationPackage, false, DeploymentJobs.JobType.productionUsEast3); assertEquals("Production job is retried", 1, tester.buildSystem().jobs().size()); - assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).deploying().platform().get()); + assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).change().platform().get()); // Another version is released, which cancels any pending upgrades to lower versions version = Version.fromString("5.2"); @@ -66,7 +66,7 @@ public class FailureRedeployerTest { tester.deployAndNotify(app, applicationPackage, true, DeploymentJobs.JobType.productionUsEast3); // Finish previous production job. tester.upgrader().maintain(); assertEquals("Application starts upgrading to new version", 1, tester.buildSystem().jobs().size()); - assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).deploying().platform().get()); + assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).change().platform().get()); // Failure redeployer does not retry failing job for prod.us-east-3 as there's an ongoing deployment tester.clock().advance(Duration.ofMinutes(1)); @@ -150,7 +150,7 @@ public class FailureRedeployerTest { tester.updateVersionStatus(version); assertEquals(version, tester.controller().versionStatus().systemVersion().get().versionNumber()); tester.upgrader().maintain(); - assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).deploying().platform().get()); + assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).change().platform().get()); // system-test fails and exhausts all immediate retries tester.deployAndNotify(app, applicationPackage, false, DeploymentJobs.JobType.systemTest); @@ -164,7 +164,7 @@ public class FailureRedeployerTest { tester.updateVersionStatus(version); assertEquals(version, tester.controller().versionStatus().systemVersion().get().versionNumber()); tester.upgrader().maintain(); - assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).deploying().platform().get()); + assertEquals("Application has pending upgrade to " + version, version, tester.application(app.id()).change().platform().get()); // Consume system-test job for 5.2 tester.buildSystem().takeJobsToRun(); @@ -225,12 +225,12 @@ public class FailureRedeployerTest { // Deployment notifies completeness but has not actually made a deployment tester.notifyJobCompletion(DeploymentJobs.JobType.productionCdUsCentral1, application, true); - assertTrue("Change not really deployed", tester.application(application.id()).deploying().isPresent()); + 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.notifyJobCompletion(DeploymentJobs.JobType.productionCdUsCentral1, application, true); - assertFalse("Change not really deployed", tester.application(application.id()).deploying().isPresent()); + assertFalse("Change not really deployed", tester.application(application.id()).change().isPresent()); } @Test diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java index 690e5c6d512..3d34e78c759 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java @@ -33,7 +33,7 @@ public class OutstandingChangeDeployerTest { Version version = new Version(6, 2); tester.deploymentTrigger().triggerChange(tester.application("app1").id(), Change.of(version)); - assertEquals(Change.of(version), tester.application("app1").deploying()); + assertEquals(Change.of(version), tester.application("app1").change()); assertFalse(tester.application("app1").hasOutstandingChange()); tester.notifyJobCompletion(DeploymentJobs.JobType.component, tester.application("app1"), true); assertTrue(tester.application("app1").hasOutstandingChange()); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java index c435aed96ee..ccc029a9654 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java @@ -173,11 +173,11 @@ public class UpgraderTest { assertEquals(VespaVersion.Confidence.normal, tester.controller().versionStatus().systemVersion().get().confidence()); tester.upgrader().maintain(); assertEquals("Upgrade of defaults are scheduled", 5, tester.buildSystem().jobs().size()); - assertEquals(version54, tester.application(default0.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default1.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default2.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default3.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default4.id()).deploying().platform().get()); + assertEquals(version54, tester.application(default0.id()).change().platform().get()); + assertEquals(version54, tester.application(default1.id()).change().platform().get()); + assertEquals(version54, tester.application(default2.id()).change().platform().get()); + assertEquals(version54, tester.application(default3.id()).change().platform().get()); + assertEquals(version54, tester.application(default4.id()).change().platform().get()); tester.completeUpgrade(default0, version54, "default"); // State: Default applications started upgrading to 5.4 (and one completed) Version version55 = Version.fromString("5.5"); @@ -189,11 +189,11 @@ public class UpgraderTest { assertEquals(VespaVersion.Confidence.normal, tester.controller().versionStatus().systemVersion().get().confidence()); tester.upgrader().maintain(); assertEquals("Upgrade of defaults are scheduled", 5, tester.buildSystem().jobs().size()); - assertEquals(version55, tester.application(default0.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default1.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default2.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default3.id()).deploying().platform().get()); - assertEquals(version54, tester.application(default4.id()).deploying().platform().get()); + assertEquals(version55, tester.application(default0.id()).change().platform().get()); + assertEquals(version54, tester.application(default1.id()).change().platform().get()); + assertEquals(version54, tester.application(default2.id()).change().platform().get()); + assertEquals(version54, tester.application(default3.id()).change().platform().get()); + assertEquals(version54, tester.application(default4.id()).change().platform().get()); tester.completeUpgrade(default1, version54, "default"); tester.completeUpgrade(default2, version54, "default"); tester.completeUpgradeWithError(default3, version54, "default", DeploymentJobs.JobType.stagingTest); @@ -215,7 +215,7 @@ public class UpgraderTest { assertEquals("Upgrade of defaults are scheduled on 5.4 instead, since 5.5 broken: " + "This is default3 since it failed upgrade on both 5.4 and 5.5", 1, tester.buildSystem().jobs().size()); - assertEquals("5.4", tester.application(default3.id()).deploying().platform().get().toString()); + assertEquals("5.4", tester.application(default3.id()).change().platform().get().toString()); } @Test @@ -319,7 +319,7 @@ public class UpgraderTest { tester.notifyJobCompletion(DeploymentJobs.JobType.stagingTest, app, false); assertTrue("Retries exhausted", tester.buildSystem().jobs().isEmpty()); assertTrue("Failure is recorded", tester.application(app.id()).deploymentJobs().hasFailures()); - assertTrue("Application has pending change", tester.application(app.id()).deploying().isPresent()); + assertTrue("Application has pending change", tester.application(app.id()).change().isPresent()); // New version is released version = Version.fromString("5.2"); @@ -378,7 +378,7 @@ public class UpgraderTest { tester.upgrader().maintain(); // 5th app passes system-test, but does not trigger next job as upgrade is cancelled - assertFalse("No change present", tester.applications().require(default4.id()).deploying().isPresent()); + assertFalse("No change present", tester.applications().require(default4.id()).change().isPresent()); tester.notifyJobCompletion(DeploymentJobs.JobType.systemTest, default4, true); assertTrue("All jobs consumed", tester.buildSystem().jobs().isEmpty()); } @@ -475,7 +475,7 @@ public class UpgraderTest { assertEquals(v2, tester.application("default0").deployments().get(ZoneId.from("prod.us-west-1")).version()); assertEquals("Last zone is upgraded to v1", v1, tester.application("default0").deployments().get(ZoneId.from("prod.us-east-3")).version()); - assertFalse(tester.application("default0").deploying().isPresent()); + assertFalse(tester.application("default0").change().isPresent()); } @Test @@ -746,7 +746,7 @@ public class UpgraderTest { // 5th app never reports back and has a dead job, but no ongoing change Application deadLocked = tester.applications().require(default4.id()); assertTrue("Jobs in progress", deadLocked.deploymentJobs().isRunning(tester.controller().applications().deploymentTrigger().jobTimeoutLimit())); - assertFalse("No change present", deadLocked.deploying().isPresent()); + assertFalse("No change present", deadLocked.change().isPresent()); // 4 out of 5 applications are repaired and confidence is restored ApplicationPackage defaultApplicationPackageV2 = new ApplicationPackageBuilder() diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java index 46389b288c4..ffb9ee57351 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java @@ -114,7 +114,7 @@ public class ApplicationSerializerTest { assertEquals(original.ownershipIssueId(), serialized.ownershipIssueId()); - assertEquals(original.deploying(), serialized.deploying()); + assertEquals(original.change(), serialized.change()); assertEquals(original.rotation().get().id(), serialized.rotation().get().id()); // Test cluster utilization @@ -147,20 +147,20 @@ public class ApplicationSerializerTest { { // test more deployment serialization cases Application original2 = writable(original).withDeploying(Change.of(ApplicationVersion.from("hash1"))); Application serialized2 = applicationSerializer.fromSlime(applicationSerializer.toSlime(original2)); - assertEquals(original2.deploying(), serialized2.deploying()); - assertEquals(serialized2.deploying().application().get().source(), - original2.deploying().application().get().source()); + assertEquals(original2.change(), serialized2.change()); + assertEquals(serialized2.change().application().get().source(), + original2.change().application().get().source()); Application original3 = writable(original).withDeploying(Change.of(ApplicationVersion.from("hash1", new SourceRevision("a", "b", "c")))); Application serialized3 = applicationSerializer.fromSlime(applicationSerializer.toSlime(original3)); - assertEquals(original3.deploying(), serialized2.deploying()); - assertEquals(serialized3.deploying().application().get().source(), - original3.deploying().application().get().source()); + assertEquals(original3.change(), serialized2.change()); + assertEquals(serialized3.change().application().get().source(), + original3.change().application().get().source()); Application original4 = writable(original).withDeploying(Change.empty()); Application serialized4 = applicationSerializer.fromSlime(applicationSerializer.toSlime(original4)); - assertEquals(original4.deploying(), serialized4.deploying()); + assertEquals(original4.change(), serialized4.change()); } } |