summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2023-03-10 09:14:48 +0100
committerjonmv <venstad@gmail.com>2023-03-10 09:14:48 +0100
commit8197eb4fb0ab6f8459777fb9c9dc9fa9b4053e7a (patch)
tree7b180027adcb59ea75c52673baba2a8621596338
parent7284e71d05812bd972429a112bd49fd80a6939d3 (diff)
Improve validation error message
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java14
2 files changed, 13 insertions, 6 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java
index 842d99abe71..bd42587576d 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/pkg/ApplicationPackageValidator.java
@@ -225,14 +225,15 @@ public class ApplicationPackageValidator {
oldEndpoint.allowedUrns().stream().map(AllowedUrn::toString).collect(joining(", ", "[", "]")) +
", but does not include all these in the new deployment spec. " +
"Deploying with the new settings will allow access to " +
- (newEndpoint.allowedUrns().isEmpty() ? "no one" : newEndpoint.allowedUrns().stream().map(AllowedUrn::toString).collect(joining(", ", "[", "]"))));
+ (newEndpoint.allowedUrns().isEmpty() ? "no one" : newEndpoint.allowedUrns().stream().map(AllowedUrn::toString).collect(joining(", ", "[", "]")) +
+ ". " + ValidationOverrides.toAllowMessage(validationId)));
});
newEndpoints.forEach((cluster, newEndpoint) -> {
ZoneEndpoint oldEndpoint = oldEndpoints.getOrDefault(cluster, ZoneEndpoint.defaultEndpoint);
if (oldEndpoint.isPublicEndpoint() && ! newEndpoint.isPublicEndpoint())
throw new IllegalArgumentException(prefix + "has a public endpoint for cluster '" + cluster.value() +
"' in '" + zone.region().get().value() + "', but the new deployment spec " +
- "disables this");
+ "disables this. " + ValidationOverrides.toAllowMessage(validationId));
});
});
}
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 a049b614e25..8f0536480f5 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
@@ -1128,7 +1128,10 @@ public class ControllerTest {
</prod>
</deployment>"""));
- assertEquals("zone-endpoint-change: application 'tenant.application' has a public endpoint for cluster 'foo' in 'us-east-3', but the new deployment spec disables this",
+ assertEquals("zone-endpoint-change: application 'tenant.application' has a public endpoint for " +
+ "cluster 'foo' in 'us-east-3', but the new deployment spec disables this. " +
+ "To allow this add <allow until='yyyy-mm-dd'>zone-endpoint-change</allow> to validation-overrides.xml, " +
+ "see https://docs.vespa.ai/en/reference/validation-overrides.html",
assertThrows(IllegalArgumentException.class,
() -> app.submit(ApplicationPackageBuilder.fromDeploymentXml("""
<deployment>
@@ -1168,9 +1171,12 @@ public class ControllerTest {
ValidationId.zoneEndpointChange));
// Changing URNs is guarded.
- assertEquals("zone-endpoint-change: application 'tenant.application' allows access to cluster 'foo' in 'us-east-3' to " +
- "['yarn' through 'aws-private-link'], but does not include all these in the new deployment spec. " +
- "Deploying with the new settings will allow access to ['yarn' through 'gcp-service-connect']",
+ assertEquals("zone-endpoint-change: application 'tenant.application' allows access to cluster " +
+ "'foo' in 'us-east-3' to ['yarn' through 'aws-private-link'], " +
+ "but does not include all these in the new deployment spec. " +
+ "Deploying with the new settings will allow access to ['yarn' through 'gcp-service-connect']. " +
+ "To allow this add <allow until='yyyy-mm-dd'>zone-endpoint-change</allow> to validation-overrides.xml, " +
+ "see https://docs.vespa.ai/en/reference/validation-overrides.html",
assertThrows(IllegalArgumentException.class,
() -> app.submit(ApplicationPackageBuilder.fromDeploymentXml("""
<deployment>