From c3903daaac8bdf318b82f606720d6e688e68a85b Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Fri, 27 Mar 2020 12:03:52 +0100 Subject: Check docker image as well in needsPlatformUpgrade() --- .../yahoo/vespa/hosted/controller/deployment/NodeWithServices.java | 3 ++- .../yahoo/vespa/hosted/controller/integration/ConfigServerMock.java | 4 ++++ .../vespa/hosted/controller/integration/NodeRepositoryMock.java | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/NodeWithServices.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/NodeWithServices.java index e3cebfad31c..921bf045873 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/NodeWithServices.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/NodeWithServices.java @@ -53,7 +53,8 @@ public class NodeWithServices { } public boolean needsPlatformUpgrade() { - return node.wantedVersion().isAfter(node.currentVersion()); + return node.wantedVersion().isAfter(node.currentVersion()) + || ! node.wantedDockerImage().equals(node.currentDockerImage()); } public boolean needsReboot() { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java index 204e0a1c1b8..9e9d27fd744 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/ConfigServerMock.java @@ -6,6 +6,7 @@ import com.yahoo.component.AbstractComponent; import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; +import com.yahoo.config.provision.DockerImage; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.NodeResources; @@ -72,6 +73,7 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer private final Map serviceStatus = new HashMap<>(); private final Set disallowConvergenceCheckApplications = new HashSet<>(); private final Version initialVersion = new Version(6, 1, 0); + private final DockerImage initialDockerImage = DockerImage.fromString("dockerImage:6.1.0"); private final Set suspendedApplications = new HashSet<>(); private final Map> loadBalancers = new HashMap<>(); private final Set deferLoadBalancerProvisioning = new HashSet<>(); @@ -105,6 +107,8 @@ public class ConfigServerMock extends AbstractComponent implements ConfigServer .parentHostname(parent.hostname()) .currentVersion(initialVersion) .wantedVersion(initialVersion) + .currentDockerImage(initialDockerImage) + .wantedDockerImage(initialDockerImage) .currentOsVersion(Version.emptyVersion) .wantedOsVersion(Version.emptyVersion) .resources(new NodeResources(2, 8, 50, 1, slow, remote)) diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryMock.java index 632b8499e11..4aab21a44fe 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/NodeRepositoryMock.java @@ -208,7 +208,10 @@ public class NodeRepositoryMock implements NodeRepository { public void doUpgrade(DeploymentId deployment, Optional hostName, Version version) { modifyNodes(deployment, hostName, node -> { assert node.wantedVersion().equals(version); - return new Node.Builder(node).currentVersion(version).build(); + return new Node.Builder(node) + .currentVersion(version) + .currentDockerImage(node.wantedDockerImage()) + .build(); }); } -- cgit v1.2.3