Skip to content

Commit

Permalink
GH-849: Add pre_without_version and build_without_version (#910)
Browse files Browse the repository at this point in the history
* WIP: bug #849

* GH-849: Add build without version

Co-authored-by: Kris De Volder <[email protected]>
  • Loading branch information
Nieraj Singh and kdvolder authored Nov 30, 2022
1 parent 187b2de commit 5f422bd
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,9 @@ private void initializeDefaultResourceTypes() {
AbstractType get = f.ybean("SemverGetParams");
addProp(get, "bump", f.yenum("SemverBump", "major", "minor", "patch", "final"));
addProp(get, "pre", t_ne_string);
addProp(get, "pre_without_version", t_boolean);
addProp(get, "build_without_version", t_boolean);


AbstractType put = f.ybean("SemverPutParams");
for (YTypedProperty p : get.getProperties()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*Optional.* Same as pre_without_version but for build labels.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*Optional.* By default `false`, once it's set to `true`
then PreRelease will be bumped without a version number.
Original file line number Diff line number Diff line change
Expand Up @@ -3714,7 +3714,67 @@ public void resourceAttributeHovers() throws Exception {
editor.assertProblems("version|Unused 'Resource'");
editor.assertHoverContains("openstack", "All openstack configuration");
}

@Test public void GH_849_pre_without_version() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +
"- name: test\n" +
" type: semver\n" +
" source:\n" +
" driver: git\n" +
" uri: some-git-url\n" +
" branch: main\n" +
" file: VERSION\n" +
"jobs:\n" +
"- name: test\n" +
" plan:\n" +
" - get: test\n" +
" params:\n" +
" pre_without_version: not-a-bool\n" +
" - put: test\n" +
" params:\n" +
" pre_without_version: not-b-bool\n"
);
editor.assertProblems(
"not-a-bool|boolean",
"not-b-bool|boolean"
);

editor.assertHoverContains("pre_without_version", 1, "PreRelease will be bumped");
editor.assertHoverContains("pre_without_version", 2, "PreRelease will be bumped");
}


@Test public void GH_849_build_without_version() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +
"- name: test\n" +
" type: semver\n" +
" source:\n" +
" driver: git\n" +
" uri: some-git-url\n" +
" branch: main\n" +
" file: VERSION\n" +
"jobs:\n" +
"- name: test\n" +
" plan:\n" +
" - get: test\n" +
" params:\n" +
" build_without_version: not-a-bool\n" +
" - put: test\n" +
" params:\n" +
" build_without_version: not-b-bool\n"
);
editor.assertProblems(
"not-a-bool|boolean",
"not-b-bool|boolean"
);

editor.assertHoverContains("build_without_version", 1, "Same as pre_without_version but for build labels");
editor.assertHoverContains("build_without_version", 2, "Same as pre_without_version but for build labels");

}

@Test public void semverResourceGetParamsReconcileAndHovers() throws Exception {
Editor editor = harness.newEditor(
"resources:\n" +
Expand Down

0 comments on commit 5f422bd

Please sign in to comment.