Detect concflict between random-route and routes

This commit is contained in:
Kris De Volder
2017-06-26 12:58:48 -07:00
parent 5ccb92f84e
commit e8617bcce5
2 changed files with 51 additions and 6 deletions

View File

@@ -113,7 +113,8 @@ public class ManifestYmlSchema implements YamlSchema {
AbstractType application = f.ybean("Application");
application.require(this::verify_heatth_check_http_end_point_constraint);
application.require(
ManifestConstraints.mutuallyExclusive("routes", "domain", "domains", "host", "hosts", "no-hostname"));
ManifestConstraints.mutuallyExclusive("routes", "domain", "domains", "host", "hosts", "no-hostname", "random-route"));
YAtomicType t_path = f.yatomic("Path");
YAtomicType t_buildpack = f.yatomic("Buildpack");

View File

@@ -583,7 +583,7 @@ public class ManifestYamlEditorTest {
editor.assertProblems(
"no-hostname|Property cannot co-exist with property 'routes'",
"routes|Property cannot co-exist with properties [no-hostname]"
);
);
editor = harness.newEditor(
"no-hostname: true\n" +
@@ -599,7 +599,7 @@ public class ManifestYamlEditorTest {
"no-hostname|Property cannot co-exist with property 'routes'",
"no-hostname|Property cannot co-exist with property 'routes'",
"routes|Property cannot co-exist with properties [no-hostname]"
);
);
editor = harness.newEditor(
"no-hostname: true\n" +
@@ -615,7 +615,7 @@ public class ManifestYamlEditorTest {
"no-hostname|Property cannot co-exist with property 'routes'",
"host|Property cannot co-exist with property 'routes'",
"routes|Property cannot co-exist with properties [host, no-hostname]"
);
);
editor = harness.newEditor(
"no-hostname: true\n" +
@@ -633,8 +633,52 @@ public class ManifestYamlEditorTest {
"no-hostname|Property cannot co-exist with property 'routes'",
"routes|Property cannot co-exist with properties [no-hostname]",
"routes|Property cannot co-exist with properties [no-hostname]"
);
}
);
}
@Test public void randomRoutesWithRoutesValidation() throws Exception {
Editor editor;
editor = harness.newEditor(
"applications:\n" +
"- name: moriarty-app\n" +
" random-route: true\n" +
" routes:\n" +
" - route: tcp.local2.pcfdev.io:61001"
);
editor.ignoreProblem("UnknownDomainProblem");
editor.assertProblems(
"random-route|Property cannot co-exist with property 'routes'",
"routes|Property cannot co-exist with properties [random-route]"
);
editor = harness.newEditor(
"random-route: true\n" +
"applications:\n" +
"- name: moriarty-app\n" +
" routes:\n" +
" - route: tcp.local2.pcfdev.io:61001"
);
editor.ignoreProblem("UnknownDomainProblem");
editor.assertProblems(
"random-route|Property cannot co-exist with property 'routes'",
"routes|Property cannot co-exist with properties [random-route]"
);
editor = harness.newEditor(
"random-route: true\n" +
"applications:\n" +
"- name: moriarty-app\n" +
" routes:\n" +
" - route: tcp.local2.pcfdev.io:61001"
);
editor.ignoreProblem("UnknownDomainProblem");
editor.assertProblems(
"random-route|Property cannot co-exist with property 'routes'",
"routes|Property cannot co-exist with properties [random-route]"
);
}
@Test public void deprecatedHealthCheckTypeQuickfix() throws Exception {
Editor editor = harness.newEditor(