aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-09-15 22:31:17 +0200
committerJon Bratseth <bratseth@gmail.com>2022-09-15 22:31:17 +0200
commitf0fb52ee9ac0aa0de72ddf792c6cb72c8c615350 (patch)
treefc52d99485e2b7f703d48f2119021219af1c9d37 /controller-server
parentd7c4706c5ab23025d6fb33a0a8f2193943ae4be9 (diff)
Make validation messages clearer given multiple instances
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java7
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java2
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java9
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java6
4 files changed, 13 insertions, 11 deletions
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 92c3198175a..92ebc5b7177 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
@@ -695,9 +695,10 @@ public class ApplicationController {
deploymentsToRemove.stream()
.map(zone -> zone.region().value())
.collect(joining(", ")) +
- ", but does not include " +
- (deploymentsToRemove.size() > 1 ? "these zones" : "this zone") +
- " in deployment.xml. " +
+ ", but " + (deploymentsToRemove.size() > 1 ? "these " : "this ") +
+ "instance and region combination" +
+ (deploymentsToRemove.size() > 1 ? "s are" : " is") +
+ " removed from deployment.xml. " +
ValidationOverrides.toAllowMessage(ValidationId.deploymentRemoval));
// Remove the instance as well, if it is no longer referenced, and contains only production deployments that are removed now.
boolean removeInstance = ! deploymentSpec.instanceNames().contains(instance)
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java
index 402a4bf49a8..71d694db522 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Instance.java
@@ -220,6 +220,6 @@ public class Instance {
@Override
public String toString() {
- return "application '" + id + "'";
+ return "application instance '" + id + "'";
}
}
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 554bf2a57b4..5d5844030e7 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
@@ -175,12 +175,13 @@ public class ControllerTest {
fail("Expected exception due to illegal production deployment removal");
}
catch (IllegalArgumentException e) {
- assertEquals("deployment-removal: application 'tenant.application' is deployed in us-west-1, but does not include this zone in deployment.xml. " +
- ValidationOverrides.toAllowMessage(ValidationId.deploymentRemoval),
- e.getMessage());
+ assertEquals("deployment-removal: application instance 'tenant.application' is deployed in us-west-1, " +
+ "but this instance and region combination is removed from deployment.xml. " +
+ ValidationOverrides.toAllowMessage(ValidationId.deploymentRemoval),
+ e.getMessage());
}
assertNotNull(context.instance().deployments().get(productionUsWest1.zone()),
- "Zone was not removed");
+ "Zone was not removed");
// prod zone removal is allowed with override
applicationPackage = new ApplicationPackageBuilder()
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
index e3292700432..3d1c19bdf98 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
@@ -972,14 +972,14 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Invalid deployment fails
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/global-rotation", GET)
.userIdentity(USER_ID),
- "{\"error-code\":\"NOT_FOUND\",\"message\":\"application 'tenant1.application1.instance1' has no deployment in prod.us-central-1\"}",
+ "{\"error-code\":\"NOT_FOUND\",\"message\":\"application instance 'tenant1.application1.instance1' has no deployment in prod.us-central-1\"}",
404);
// Change status of non-existing deployment fails
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-central-1/global-rotation/override", PUT)
.userIdentity(USER_ID)
.data("{\"reason\":\"unit-test\"}"),
- "{\"error-code\":\"NOT_FOUND\",\"message\":\"application 'tenant1.application1.instance1' has no deployment in prod.us-central-1\"}",
+ "{\"error-code\":\"NOT_FOUND\",\"message\":\"application instance 'tenant1.application1.instance1' has no deployment in prod.us-central-1\"}",
404);
// GET global rotation status
@@ -1037,7 +1037,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
// GET global rotation status without specifying endpointId fails
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/instance/instance1/environment/prod/region/us-west-1/global-rotation", GET)
.userIdentity(USER_ID),
- "{\"error-code\":\"BAD_REQUEST\",\"message\":\"application 'tenant1.application1.instance1' has multiple rotations. Query parameter 'endpointId' must be given\"}",
+ "{\"error-code\":\"BAD_REQUEST\",\"message\":\"application instance 'tenant1.application1.instance1' has multiple rotations. Query parameter 'endpointId' must be given\"}",
400);
// GET global rotation status for us-west-1 in default endpoint