summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <jvenstad@yahoo-inc.com>2019-01-21 11:50:18 +0100
committerJon Marius Venstad <jvenstad@yahoo-inc.com>2019-01-21 11:50:18 +0100
commit5c7b920a22e1fe328cfe2ae4fe7d8a5e57e4a66f (patch)
treea1da0c3635f4eb2f0724fb0ef4a0038dfc98cb74 /controller-server
parent3722c1cdd91fce30d1c2538b2a8749d9321e194b (diff)
Rename isPresent to hasTargets, and display change which is only pin in REST API
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/ApplicationList.java4
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java7
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java4
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployer.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java8
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java10
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTester.java10
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTriggerTest.java28
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/OutstandingChangeDeployerTest.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java27
13 files changed, 58 insertions, 56 deletions
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 ca6fa083f1b..6f1e108ea77 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
@@ -84,12 +84,12 @@ public class ApplicationList {
/** Returns the subset of applications which have changes left to deploy; blocked, or deploying */
public ApplicationList withChanges() {
- return listOf(list.stream().filter(application -> application.change().isPresent() || application.outstandingChange().isPresent()));
+ return listOf(list.stream().filter(application -> application.change().hasTargets() || application.outstandingChange().hasTargets()));
}
/** Returns the subset of applications which are currently not deploying a change */
public ApplicationList notDeploying() {
- return listOf(list.stream().filter(application -> ! application.change().isPresent()));
+ return listOf(list.stream().filter(application -> ! application.change().hasTargets()));
}
/** Returns the subset of applications which currently does not have any failing jobs */
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java
index 7b77105cc67..af63e8e5da7 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Change.java
@@ -50,10 +50,15 @@ public final class Change {
}
/** Returns whether a change should currently be deployed */
- public boolean isPresent() {
+ public boolean hasTargets() {
return platform.isPresent() || application.isPresent();
}
+ /** Returns whether this is the empty change. */
+ public boolean isEmpty() {
+ return ! hasTargets() && ! pinned;
+ }
+
/** Returns the platform version carried by this. */
public Optional<Version> platform() { return platform; }
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 f6f843cabcb..c8ac0c1b0e2 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
@@ -236,7 +236,7 @@ public class DeploymentTrigger {
/** Triggers a change of this application, unless it already has a change. */
public void triggerChange(ApplicationId applicationId, Change change) {
applications().lockOrThrow(applicationId, application -> {
- if ( ! application.get().change().isPresent())
+ if ( ! application.get().change().hasTargets())
forceChange(applicationId, change);
});
}
@@ -315,7 +315,7 @@ public class DeploymentTrigger {
List<Job> testJobs = null; // null means "uninitialised", while empty means "don't run any jobs".
DeploymentSteps steps = steps(application.deploymentSpec());
- if (change.isPresent()) {
+ if (change.hasTargets()) {
for (Step step : steps.production()) {
List<JobType> stepJobs = steps.toJobs(step);
List<JobType> remainingJobs = stepJobs.stream().filter(job -> ! isComplete(change, application, job)).collect(toList());
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 2b317032c52..b34bd65901e 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
@@ -20,7 +20,7 @@ public class OutstandingChangeDeployer extends Maintainer {
@Override
protected void maintain() {
for (Application application : controller().applications().asList()) {
- if ( application.outstandingChange().isPresent()
+ if ( application.outstandingChange().hasTargets()
&& application.deploymentSpec().canChangeRevisionAt(controller().clock().instant())) {
controller().applications().deploymentTrigger().triggerChange(application.id(),
application.outstandingChange());
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 ffb900f0fac..fa474f5c5e0 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
@@ -282,7 +282,7 @@ public class ApplicationSerializer {
}
private void toSlime(Change deploying, Cursor parentObject, String fieldName) {
- if ( ! deploying.isPresent() && ! deploying.isPinned()) return;
+ if (deploying.isEmpty()) return;
Cursor object = parentObject.setObject(fieldName);
if (deploying.platform().isPresent())
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 a4053b6db15..1d02a25bde5 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
@@ -14,7 +14,6 @@ import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.container.jdisc.LoggingRequestHandler;
import com.yahoo.io.IOUtils;
-import com.yahoo.jdisc.Response;
import com.yahoo.log.LogLevel;
import com.yahoo.restapi.Path;
import com.yahoo.slime.Cursor;
@@ -86,7 +85,6 @@ import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.NotAuthorizedException;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.Principal;
@@ -427,12 +425,12 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
.ifPresent(id -> object.setLong("projectId", id));
// Currently deploying change
- if (application.change().isPresent()) {
+ if ( ! application.change().isEmpty()) {
toSlime(object.setObject("deploying"), application.change());
}
// Outstanding change
- if (application.outstandingChange().isPresent()) {
+ if ( ! application.outstandingChange().isEmpty()) {
toSlime(object.setObject("outstandingChange"), application.outstandingChange());
}
@@ -823,7 +821,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler {
StringBuilder response = new StringBuilder();
controller.applications().lockOrThrow(id, application -> {
Change change = application.get().change();
- if ( ! change.isPresent() && ! change.isPinned()) {
+ if (change.isEmpty()) {
response.append("No deployment in progress for " + application + " at this time");
return;
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
index 7d49ffe8139..218fac75185 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelper.java
@@ -98,7 +98,7 @@ class JobControllerApiHandlerHelper {
lastPlatformToSlime(lastVersionsObject.setObject("platform"), controller, application, change, steps);
lastApplicationToSlime(lastVersionsObject.setObject("application"), application, change, steps, controller);
- if (change.isPresent()) {
+ if ( ! change.isEmpty()) {
Cursor deployingObject = responseObject.setObject("deploying");
change.platform().ifPresent(version -> deployingObject.setString("platform", version.toString()));
change.application().ifPresent(version -> applicationVersionToSlime(deployingObject.setObject("application"), version));
@@ -161,9 +161,9 @@ class JobControllerApiHandlerHelper {
}
else
lastPlatformObject.setString("pending",
- application.change().isPresent()
- ? "Waiting for current deployment to complete"
- : "Waiting for upgrade slot");
+ application.change().isEmpty()
+ ? "Waiting for upgrade slot"
+ : "Waiting for current deployment to complete");
}
private static void lastApplicationToSlime(Cursor lastApplicationObject, Application application, Change change, DeploymentSteps steps, Controller controller) {
@@ -199,7 +199,7 @@ class JobControllerApiHandlerHelper {
.isPresent());
if (running.containsKey(type))
deploymentObject.setString("status", running.get(type).steps().get(deployReal) == unfinished ? "deploying" : "verifying");
- else if (change.isPresent())
+ else if (change.hasTargets())
deploymentObject.setString("status", pendingProduction.containsKey(type) ? "pending" : "completed");
}
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 7cb788b14aa..686463cc0cf 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
@@ -189,7 +189,7 @@ public class DeploymentTester {
}
private void completeDeployment(Application application, ApplicationPackage applicationPackage, Optional<JobType> failOnJob) {
- assertTrue(applications().require(application.id()).change().isPresent());
+ assertTrue(applications().require(application.id()).change().hasTargets());
DeploymentSteps steps = controller().applications().deploymentTrigger().steps(applicationPackage.deploymentSpec());
List<JobType> jobs = steps.jobs();
for (JobType job : jobs) {
@@ -200,10 +200,10 @@ public class DeploymentTester {
}
}
if (failOnJob.isPresent()) {
- assertTrue(applications().require(application.id()).change().isPresent());
+ assertTrue(applications().require(application.id()).change().hasTargets());
assertTrue(applications().require(application.id()).deploymentJobs().hasFailures());
} else {
- assertFalse(applications().require(application.id()).change().isPresent());
+ assertFalse(applications().require(application.id()).change().hasTargets());
}
}
@@ -212,7 +212,7 @@ public class DeploymentTester {
}
public void completeUpgrade(Application application, Version version, ApplicationPackage applicationPackage) {
- assertTrue(application + " has a change", applications().require(application.id()).change().isPresent());
+ assertTrue(application + " has a change", applications().require(application.id()).change().hasTargets());
assertEquals(Change.of(version), applications().require(application.id()).change());
completeDeployment(application, applicationPackage, Optional.empty());
}
@@ -226,7 +226,7 @@ public class DeploymentTester {
}
private void completeUpgradeWithError(Application application, Version version, ApplicationPackage applicationPackage, Optional<JobType> failOnJob) {
- assertTrue(applications().require(application.id()).change().isPresent());
+ assertTrue(applications().require(application.id()).change().hasTargets());
assertEquals(Change.of(version), applications().require(application.id()).change());
completeDeployment(application, applicationPackage, failOnJob);
}
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 68a36874dc7..aa2b4d03028 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
@@ -363,13 +363,13 @@ public class DeploymentTriggerTest {
tester.deploy(JobType.productionUsWest1, app, applicationPackage);
tester.jobCompletion(JobType.productionUsWest1).application(app).submit();
assertTrue("Change is present as not all jobs are complete",
- tester.applications().require(app.id()).change().isPresent());
+ tester.applications().require(app.id()).change().hasTargets());
// All jobs complete
tester.deploy(JobType.productionUsEast3, app, applicationPackage);
tester.jobCompletion(JobType.productionUsEast3).application(app).submit();
assertFalse("Change has been deployed",
- tester.applications().require(app.id()).change().isPresent());
+ tester.applications().require(app.id()).change().hasTargets());
}
@Test
@@ -445,12 +445,12 @@ public class DeploymentTriggerTest {
.sourceRevision(new SourceRevision("repository1", "master", "cafed00d"))
.uploadArtifact(changedApplication)
.submit();
- assertTrue(tester.applications().require(app.id()).outstandingChange().isPresent());
+ assertTrue(tester.applications().require(app.id()).outstandingChange().hasTargets());
tester.deployAndNotify(app, changedApplication, true, systemTest);
tester.deployAndNotify(app, changedApplication, true, stagingTest);
tester.outstandingChangeDeployer().run();
- assertTrue(tester.applications().require(app.id()).outstandingChange().isPresent());
+ assertTrue(tester.applications().require(app.id()).outstandingChange().hasTargets());
readyJobsTrigger.run();
assertEquals(emptyList(), tester.buildService().jobs());
@@ -458,7 +458,7 @@ public class DeploymentTriggerTest {
tester.clock().advance(Duration.ofHours(2)); // ---------------- Exit block window: 20:30
tester.outstandingChangeDeployer().run();
- assertFalse(tester.applications().require(app.id()).outstandingChange().isPresent());
+ assertFalse(tester.applications().require(app.id()).outstandingChange().hasTargets());
tester.deploymentTrigger().triggerReadyJobs(); // Schedules staging test for the blocked production job(s)
assertEquals(singletonList(buildJob(app, productionUsWest1)), tester.buildService().jobs());
@@ -502,22 +502,22 @@ public class DeploymentTriggerTest {
// Upgrade is done, and oustanding change rolls out when block window ends.
assertEquals(Change.empty(), tester.application(application.id()).change());
- assertFalse(tester.application(application.id()).change().isPresent());
- assertTrue(tester.application(application.id()).outstandingChange().isPresent());
+ assertFalse(tester.application(application.id()).change().hasTargets());
+ assertTrue(tester.application(application.id()).outstandingChange().hasTargets());
tester.deployAndNotify(application, applicationPackage, true, stagingTest);
tester.deployAndNotify(application, applicationPackage, true, systemTest);
clock.advance(Duration.ofHours(1));
tester.outstandingChangeDeployer().run();
- assertTrue(tester.application(application.id()).change().isPresent());
- assertFalse(tester.application(application.id()).outstandingChange().isPresent());
+ assertTrue(tester.application(application.id()).change().hasTargets());
+ assertFalse(tester.application(application.id()).outstandingChange().hasTargets());
tester.readyJobTrigger().run();
tester.deployAndNotify(application, applicationPackage, true, productionUsWest1);
tester.deployAndNotify(application, applicationPackage, true, productionUsEast3);
- assertFalse(tester.application(application.id()).change().isPresent());
- assertFalse(tester.application(application.id()).outstandingChange().isPresent());
+ assertFalse(tester.application(application.id()).change().hasTargets());
+ assertFalse(tester.application(application.id()).outstandingChange().hasTargets());
}
@Test
@@ -695,7 +695,7 @@ public class DeploymentTriggerTest {
tester.deployAndNotify(application1, true, systemTest);
tester.deployAndNotify(application1, true, stagingTest);
tester.deployAndNotify(application1, applicationPackage, true, productionEuWest1);
- assertFalse(app1.get().change().isPresent());
+ assertFalse(app1.get().change().hasTargets());
assertFalse(app1.get().deploymentJobs().jobStatus().get(productionUsCentral1).isSuccess());
}
@@ -750,7 +750,7 @@ public class DeploymentTriggerTest {
tester.deployAndNotify(application, false, productionUsEast3);
tester.deployAndNotify(application, true, productionUsEast3);
tester.deployAndNotify(application, true, productionEuWest1);
- assertFalse(app.get().change().isPresent());
+ assertFalse(app.get().change().hasTargets());
assertEquals(43, app.get().deploymentJobs().jobStatus().get(productionEuWest1).lastSuccess().get().application().buildNumber().getAsLong());
assertEquals(43, app.get().deploymentJobs().jobStatus().get(productionUsEast3).lastSuccess().get().application().buildNumber().getAsLong());
}
@@ -1066,7 +1066,7 @@ public class DeploymentTriggerTest {
app1 = tester.application(app1.id());
assertEquals("Application change preserves version", version1, app1.oldestDeployedPlatform().get());
assertEquals(version1, tester.configServer().lastPrepareVersion().get());
- assertFalse("Change deployed", app1.change().isPresent());
+ assertFalse("Change deployed", app1.change().hasTargets());
// Version upgrade changes system version
tester.deploymentTrigger().triggerChange(app1.id(), Change.of(version2));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java
index 35e7aea5efe..ecf849fc68c 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/InternalDeploymentTester.java
@@ -161,7 +161,7 @@ public class InternalDeploymentTester {
assertTrue(tester.configServer().nodeRepository()
.list(JobType.productionUsEast3.zone(tester.controller().system()), appId).stream()
.allMatch(node -> node.currentVersion().equals(version)));
- assertFalse(app().change().isPresent());
+ assertFalse(app().change().hasTargets());
}
/**
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java
index 9c01e526a50..de23a675794 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/MetricsReporterTest.java
@@ -181,7 +181,7 @@ public class MetricsReporterTest {
tester.deployAndNotify(app, applicationPackage, true, systemTest);
tester.deployAndNotify(app, applicationPackage, true, stagingTest);
tester.deployAndNotify(app, applicationPackage, true, productionUsWest1);
- assertFalse("Change deployed", tester.controller().applications().require(app.id()).change().isPresent());
+ assertFalse("Change deployed", tester.controller().applications().require(app.id()).change().hasTargets());
// New versions is released and upgrade fails in test environments
Version version = Version.fromString("7.1");
@@ -201,7 +201,7 @@ public class MetricsReporterTest {
// Upgrade eventually succeeds
tester.deployAndNotify(app, applicationPackage, true, productionUsWest1);
- assertFalse("Upgrade deployed", tester.controller().applications().require(app.id()).change().isPresent());
+ assertFalse("Upgrade deployed", tester.controller().applications().require(app.id()).change().hasTargets());
reporter.maintain();
assertEquals(0, getDeploymentsFailingUpgrade(app));
}
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 d9846dd37ee..3a7c62c900a 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
@@ -44,7 +44,7 @@ public class OutstandingChangeDeployerTest {
tester.deploymentTrigger().triggerReadyJobs();
assertEquals(Change.of(version), tester.application("app1").change());
- assertFalse(tester.application("app1").outstandingChange().isPresent());
+ assertFalse(tester.application("app1").outstandingChange().hasTargets());
tester.jobCompletion(JobType.component)
.application(tester.application("app1"))
@@ -54,7 +54,7 @@ public class OutstandingChangeDeployerTest {
.submit();
Application app = tester.application("app1");
- assertTrue(app.outstandingChange().isPresent());
+ assertTrue(app.outstandingChange().hasTargets());
assertEquals("1.0.43-cafed00d", app.outstandingChange().application().get().id());
assertEquals(2, tester.buildService().jobs().size());
@@ -78,7 +78,7 @@ public class OutstandingChangeDeployerTest {
assertEquals(1, jobs.size());
assertEquals(JobType.productionUsWest1.jobName(), jobs.get(0).jobName());
assertEquals(11, jobs.get(0).projectId());
- assertFalse(tester.application("app1").outstandingChange().isPresent());
+ assertFalse(tester.application("app1").outstandingChange().hasTargets());
}
}
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 f93f9cceec7..25631a48dc4 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
@@ -6,7 +6,6 @@ import com.yahoo.config.provision.Environment;
import com.yahoo.config.provision.RegionName;
import com.yahoo.test.ManualClock;
import com.yahoo.vespa.hosted.controller.Application;
-import com.yahoo.vespa.hosted.controller.ApplicationController;
import com.yahoo.vespa.hosted.controller.ControllerTester;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType;
import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneId;
@@ -366,7 +365,7 @@ public class UpgraderTest {
// staging-test fails and failure is recorded
tester.deployAndNotify(app, applicationPackage, false, stagingTest);
assertTrue("Failure is recorded", tester.application(app.id()).deploymentJobs().hasFailures());
- assertTrue("Application has pending change", tester.application(app.id()).change().isPresent());
+ assertTrue("Application has pending change", tester.application(app.id()).change().hasTargets());
// New version is released
version = Version.fromString("6.4");
@@ -429,7 +428,7 @@ public class UpgraderTest {
tester.triggerUntilQuiescence();
// apps pass system-test, but do not trigger next jobs as upgrade is cancelled
- assertFalse("No change present", tester.applications().require(default4.id()).change().isPresent());
+ assertFalse("No change present", tester.applications().require(default4.id()).change().hasTargets());
tester.jobCompletion(systemTest).application(default0).submit();
tester.jobCompletion(systemTest).application(default1).submit();
tester.jobCompletion(systemTest).application(default2).submit();
@@ -531,7 +530,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").change().isPresent());
+ assertFalse(tester.application("default0").change().hasTargets());
}
@Test
@@ -812,7 +811,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());
tester.assertRunning(systemTest, deadLocked.id());
- assertFalse("No change present", deadLocked.change().isPresent());
+ assertFalse("No change present", deadLocked.change().hasTargets());
// 4 out of 5 applications are repaired and confidence is restored
ApplicationPackage defaultApplicationPackageV2 = new ApplicationPackageBuilder()
@@ -1159,16 +1158,16 @@ public class UpgraderTest {
assertEquals(Collections.emptyList(), tester.buildService().jobs()); // No jobs left.
tester.outstandingChangeDeployer().run();
- assertFalse(tester.application(app.id()).change().isPresent());
+ assertFalse(tester.application(app.id()).change().hasTargets());
clock.advance(Duration.ofHours(2));
tester.outstandingChangeDeployer().run();
- assertTrue(tester.application(app.id()).change().isPresent());
+ assertTrue(tester.application(app.id()).change().hasTargets());
tester.readyJobTrigger().run();
tester.deployAndNotify(app, applicationPackage, true, productionUsWest1);
tester.deployAndNotify(app, applicationPackage, true, productionUsCentral1);
tester.deployAndNotify(app, applicationPackage, true, productionUsEast3);
- assertFalse(tester.application(app.id()).change().isPresent());
+ assertFalse(tester.application(app.id()).change().hasTargets());
}
@Test
@@ -1185,7 +1184,7 @@ public class UpgraderTest {
tester.deploymentTrigger().forceChange(application.id(), Change.empty().withPin());
tester.deployCompletely(application, applicationPackage);
- assertFalse(tester.application(application.id()).change().isPresent());
+ assertFalse(tester.application(application.id()).change().hasTargets());
assertTrue(tester.application(application.id()).change().isPinned());
assertEquals(2, tester.application(application.id()).deployments().size());
@@ -1193,18 +1192,18 @@ public class UpgraderTest {
Version version1 = Version.fromString("6.3");
tester.upgradeSystem(version1);
tester.upgrader().maintain();
- assertFalse(tester.application(application.id()).change().isPresent());
+ assertFalse(tester.application(application.id()).change().hasTargets());
assertTrue(tester.application(application.id()).change().isPinned());
// New application package is deployed.
tester.deployCompletely(application, applicationPackage, BuildJob.defaultBuildNumber + 1);
- assertFalse(tester.application(application.id()).change().isPresent());
+ assertFalse(tester.application(application.id()).change().hasTargets());
assertTrue(tester.application(application.id()).change().isPinned());
// Application upgrades to new version when pin is removed.
tester.deploymentTrigger().cancelChange(application.id(), PIN);
tester.upgrader().maintain();
- assertTrue(tester.application(application.id()).change().isPresent());
+ assertTrue(tester.application(application.id()).change().hasTargets());
assertFalse(tester.application(application.id()).change().isPinned());
// Application is pinned to new version, and upgrade is therefore not cancelled, even though confidence is broken.
@@ -1229,9 +1228,9 @@ public class UpgraderTest {
tester.deployAndNotify(application, true, systemTest);
tester.deployAndNotify(application, true, stagingTest);
tester.deployAndNotify(application, true, productionUsEast3);
- assertTrue(tester.application(application.id()).change().isPresent());
+ assertTrue(tester.application(application.id()).change().hasTargets());
tester.deployAndNotify(application, true, productionUsWest1);
- assertFalse(tester.application(application.id()).change().isPresent());
+ assertFalse(tester.application(application.id()).change().hasTargets());
}
}