Make reconcile for resoure_type type more accurate

The string typed in there now must be a resource_type name. So it can not
be empty and can not be some random string.
This commit is contained in:
Kris De Volder
2017-04-13 10:01:03 -07:00
parent c1642a1d4c
commit c86b156e42
2 changed files with 22 additions and 4 deletions

View File

@@ -165,9 +165,6 @@ public class PipelineYmlSchema implements YamlSchema {
YAtomicType t_version = f.yatomic("Version");
t_version.addHints("latest", "every");
YAtomicType t_image_type = f.yatomic("ImageType");
t_image_type.addHints("docker_image");
t_resource_type_name = f.yenumFromHints("ResourceType Name",
(parseString, validValues) -> {
return "The '"+parseString+"' Resource Type does not exist. Existing types: "+validValues;
@@ -356,7 +353,7 @@ public class PipelineYmlSchema implements YamlSchema {
AbstractType resourceType = f.ybean("ResourceType");
addProp(resourceType, "name", resourceTypeNameDef).isRequired(true);
addProp(resourceType, "type", t_image_type).isRequired(true);
addProp(resourceType, "type", t_resource_type_name).isRequired(true);
addProp(resourceType, "source", resourceSource);
AbstractType group = f.ybean("Group");

View File

@@ -66,6 +66,27 @@ public class ConcourseEditorTest {
);
}
@Test public void reconcileResourceTypeType() throws Exception {
Editor editor;
editor = harness.newEditor(
"resource_types:\n" +
"- name: s3-multi\n" +
" type: # <- bad\n"
);
editor.assertProblems(
"^ # <- bad|cannot be blank"
);
editor = harness.newEditor(
"resource_types:\n" +
"- name: s3-multi\n" +
" type: garbage\n"
);
editor.assertProblems(
"garbage|Resource Type does not exist"
);
}
@Test public void addMultipleRequiredPropertiesQuickfix() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +