No 'interacts with' error if resource does not exist.

This commit is contained in:
Kris De Volder
2017-04-24 09:41:26 -07:00
parent 411ea55bbb
commit 9862f49a7f
2 changed files with 30 additions and 1 deletions

View File

@@ -86,7 +86,7 @@ public class ConcourseModel {
if (stepNode!=null) {
StepModel step = newStep(stepNode);
String resourceName = step.getResourceName();
if (resourceName!=null) {
if (resourceName!=null && getResource(dc.getDocument(), resourceName)!=null) {
Set<String> interactions = job.getInteractedResources();
if (interactions!=null && !interactions.contains(resourceName)) {
problems.accept(YamlSchemaProblems.schemaProblem("Job '"+jobName+"' does not interact with resource '"+resourceName+"'", node));

View File

@@ -3116,6 +3116,8 @@ public class ConcourseEditorTest {
);
}
@Test public void reconcilerJobFromPassedAttributeMustInteractWithResource() throws Exception {
Editor editor;
@@ -3218,6 +3220,33 @@ public class ConcourseEditorTest {
}
@Test public void reconcilerSkipInteractsWithChecckedForNonExistantResource() throws Exception {
//See: https://www.pivotaltracker.com/story/show/144217965
Editor editor = harness.newEditor(
"resources:\n" +
"- name: version\n" +
" type: semver\n" +
"- name: source-repo\n" +
" type: git\n" +
"jobs:\n" +
"- name: build-it\n" +
" plan:\n" +
" - aggregate:\n" +
" - put: version\n" +
" - get: source-repo\n" +
"- name: test-it\n" +
" plan:\n" +
" - get: source-repo\n" +
" passed:\n" +
" - build-it\n" +
" - get: versi\n" +
" passed:\n" +
" - build-it"
);
editor.assertProblems("get: ^versi^|resource does not exist");
}
//////////////////////////////////////////////////////////////////////////////
private void assertContextualCompletions(String conText, String textBefore, String... textAfter) throws Exception {