No 'interacts with' error if resource does not exist.
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user