-
Notifications
You must be signed in to change notification settings - Fork 24k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime-metadata sanity test: do not fail deprecation version checks …
…if galaxy.yml has empty `version` (#83831) * Do not create invalid SemanticVersion objects. * Fix SemanticVersion.parse(). * Add basic runtime-metadata tests.
- Loading branch information
1 parent
bed9a95
commit faf446a
Showing
12 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
bugfixes: | ||
- "runtime-metadata sanity test - do not crash on deprecations if ``galaxy.yml`` contains an empty ``version`` field (https://github.com/ansible/ansible/pull/83831)." | ||
- "Fix ``SemanticVersion.parse()`` to store the version string so that ``__repr__`` reports it instead of ``None`` (https://github.com/ansible/ansible/pull/83831)." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
test/integration/targets/ansible-test-sanity-runtime-metadata/aliases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
shippable/posix/group3 # runs in the distro test containers | ||
shippable/generic/group1 # runs in the default test container | ||
context/controller | ||
needs/target/collection |
5 changes: 5 additions & 0 deletions
5
...targets/ansible-test-sanity-runtime-metadata/ansible_collections/ns/no_version/galaxy.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace: ns | ||
name: no_version | ||
version: null | ||
authors: | ||
- Ansible |
11 changes: 11 additions & 0 deletions
11
...s/ansible-test-sanity-runtime-metadata/ansible_collections/ns/no_version/meta/runtime.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
extra_key: true | ||
plugin_routing: | ||
modules: | ||
deprecated_module: | ||
deprecation: | ||
removal_version: 2.0.0 | ||
warning_text: Will no longer be there. | ||
tombstoned_module: | ||
tombstone: | ||
removal_version: 1.0.0 | ||
warning_text: Is no longer there. |
5 changes: 5 additions & 0 deletions
5
...on/targets/ansible-test-sanity-runtime-metadata/ansible_collections/ns/version/galaxy.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace: ns | ||
name: version | ||
version: 2.3.4 | ||
authors: | ||
- Ansible |
18 changes: 18 additions & 0 deletions
18
...gets/ansible-test-sanity-runtime-metadata/ansible_collections/ns/version/meta/runtime.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
plugin_routing: | ||
modules: | ||
deprecated_module: | ||
deprecation: | ||
removal_version: 3.0.0 | ||
warning_text: Will no longer be there. | ||
tombstoned_module: | ||
tombstone: | ||
removal_version: 2.0.0 | ||
warning_text: Is no longer there. | ||
deprecated_module_wrong_version: | ||
deprecation: | ||
removal_version: 2.0.0 | ||
warning_text: Will no longer be there. | ||
tombstoned_module_wrong_version: | ||
tombstone: | ||
removal_version: 3.0.0 | ||
warning_text: Is no longer there. |
1 change: 1 addition & 0 deletions
1
test/integration/targets/ansible-test-sanity-runtime-metadata/expected-no_version.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
meta/runtime.yml:0:0: extra keys not allowed @ data['extra_key']. Got True |
2 changes: 2 additions & 0 deletions
2
test/integration/targets/ansible-test-sanity-runtime-metadata/expected-version.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
meta/runtime.yml:0:0: The deprecation removal_version ('2.0.0') must be after the current version (SemanticVersion('2.3.4')) for dictionary value @ data['plugin_routing']['modules']['deprecated_module_wrong_version']['deprecation']['removal_version']. Got '2.0.0' | ||
meta/runtime.yml:0:0: The tombstone removal_version ('3.0.0') must not be after the current version (SemanticVersion('2.3.4')) for dictionary value @ data['plugin_routing']['modules']['tombstoned_module_wrong_version']['tombstone']['removal_version']. Got '3.0.0' |
15 changes: 15 additions & 0 deletions
15
test/integration/targets/ansible-test-sanity-runtime-metadata/runme.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
COLLECTION_NAME=version source ../collection/setup.sh | ||
|
||
set -eux | ||
|
||
cd ../version | ||
ansible-test sanity --test runtime-metadata --color --truncate 0 --failure-ok --lint "${@}" 1> actual-stdout.txt 2> actual-stderr.txt | ||
diff -u "${TEST_DIR}/expected-version.txt" actual-stdout.txt | ||
grep -F -f "${TEST_DIR}/expected-version.txt" actual-stderr.txt | ||
|
||
cd ../no_version | ||
ansible-test sanity --test runtime-metadata --color --truncate 0 --failure-ok --lint "${@}" 1> actual-stdout.txt 2> actual-stderr.txt | ||
diff -u "${TEST_DIR}/expected-no_version.txt" actual-stdout.txt | ||
grep -F -f "${TEST_DIR}/expected-no_version.txt" actual-stderr.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters