summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Aune <kkraune@users.noreply.github.com>2023-03-10 09:17:45 +0100
committerGitHub <noreply@github.com>2023-03-10 09:17:45 +0100
commit9329e285d9d4e96549a63064743be413817da780 (patch)
tree6e6ce59c948f34786cf4db7b712f6ebff859d2d8
parentc96886fe1c28babb62b2e837c6352d77edf3ee7e (diff)
parent8197eb4fb0ab6f8459777fb9c9dc9fa9b4053e7a (diff)
Merge pull request #26389 from vespa-engine/jonmv/improve-error-message
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>