Allow 'never' as a value for resource.check_every (concourse editor)
This commit is contained in:
@@ -38,7 +38,6 @@ import org.springframework.ide.vscode.commons.util.SimpleGlob;
|
||||
import org.springframework.ide.vscode.commons.util.SimpleGlob.Match;
|
||||
import org.springframework.ide.vscode.commons.util.ValueParser;
|
||||
import org.springframework.ide.vscode.commons.yaml.reconcile.YamlSchemaProblems;
|
||||
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YBeanType;
|
||||
import org.springframework.ide.vscode.commons.yaml.schema.constraints.Constraint;
|
||||
import org.springframework.ide.vscode.commons.yaml.schema.constraints.Constraints;
|
||||
import org.springframework.ide.vscode.commons.yaml.snippet.TypeBasedSnippetProvider;
|
||||
@@ -683,7 +682,7 @@ public class YTypeFactory {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class YAtomicType extends AbstractType {
|
||||
private final String name;
|
||||
private YAtomicType(String name) {
|
||||
@@ -809,7 +808,7 @@ public class YTypeFactory {
|
||||
}
|
||||
}
|
||||
|
||||
public class AbstractUnionType extends AbstractType {
|
||||
public static class AbstractUnionType extends AbstractType {
|
||||
protected final String name;
|
||||
protected final YType[] subtypes;
|
||||
|
||||
|
||||
@@ -130,6 +130,10 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
|
||||
public final YType t_duration = f.yatomic("Duration")
|
||||
.parseWith(ConcourseValueParsers.DURATION);
|
||||
public final YType t_duration_or_never = f.yatomic("DurationOrNever")
|
||||
.parseWith(ConcourseValueParsers.DURATION)
|
||||
.alsoAccept("never")
|
||||
.addHints("never");
|
||||
public final YType t_time_of_day = f.yatomic("TimeOfDay")
|
||||
.parseWith(ConcourseValueParsers.TIME_OF_DAY);
|
||||
public final YType t_location = f.yatomic("Location")
|
||||
@@ -264,7 +268,7 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
addProp(t_resource, "name", t_resource_name_def).isPrimary(true);
|
||||
addProp(t_resource, "type", t_resource_type_name).isRequired(true);
|
||||
addProp(t_resource, "source", resourceSource);
|
||||
addProp(t_resource, "check_every", t_duration);
|
||||
addProp(t_resource, "check_every", t_duration_or_never);
|
||||
addProp(t_resource, "tags", t_strings);
|
||||
addProp(t_resource, "webhook_token", t_ne_string);
|
||||
addProp(t_resource, "icon", t_ne_string);
|
||||
|
||||
@@ -3202,6 +3202,52 @@ public class ConcourseEditorTest {
|
||||
editor.assertHoverContains("add_claimed", "in the *claimed* state");
|
||||
editor.assertHoverContains("remove", "remove the given lock from the pool");
|
||||
}
|
||||
|
||||
@Test public void resourceCheckEveryValidation() throws Exception {
|
||||
//See: https://github.com/spring-projects/sts4/issues/816
|
||||
Editor editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: git\n" +
|
||||
" type: git\n" +
|
||||
" check_every: bad-duration\n"
|
||||
);
|
||||
|
||||
editor.assertProblems(
|
||||
"git|Unused 'Resource'",
|
||||
"bad-duration|not a valid 'Duration'"
|
||||
);
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: git\n" +
|
||||
" type: git\n" +
|
||||
" check_every: never\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"git|Unused 'Resource'"
|
||||
);
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: git\n" +
|
||||
" type: git\n" +
|
||||
" check_every: 1h\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"git|Unused 'Resource'"
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void resourceCheckEveryCompletion() throws Exception {
|
||||
//See: https://github.com/spring-projects/sts4/issues/816
|
||||
Editor editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
"- name: git\n" +
|
||||
" type: git\n" +
|
||||
" check_every: <*>"
|
||||
);
|
||||
editor.assertContainsCompletions("<*>", "never<*>");
|
||||
}
|
||||
|
||||
@Test public void semverResourceSourceReconcileAtomNotAllowed() throws Exception {
|
||||
Editor editor = harness.newEditor(
|
||||
|
||||
Reference in New Issue
Block a user