diff options
author | Matt Clay <matt@mystile.com> | 2023-07-15 02:19:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-15 02:19:33 +0200 |
commit | 765b2bd783b9ba64b7ed5d8504bedbe8265aab0e (patch) | |
tree | a919e4a6f8be6ba70502f175fdacdd55137d80f3 /test/integration/targets/ansible-test-sanity-replace-urlopen | |
parent | ansible-test - Fix sanity traceback with `-e` opt (#81271) (diff) | |
download | ansible-765b2bd783b9ba64b7ed5d8504bedbe8265aab0e.tar.xz ansible-765b2bd783b9ba64b7ed5d8504bedbe8265aab0e.zip |
ansible-test - Narrow the scope of some sanity tests (#81273)
* ansible-test - Limit scope of replace-urlopen test
Only ansible-core code and plugins in collections can be expected to rely on module_utils.
* ansible-test - Limit scope of use-compat-six test
Only ansible-core code and plugins in collections can be expected to rely on module_utils.
* ansible-test - Limit scope of no-get-exception test
Only ansible-core code and plugins in collections should be checked for usage of outdated module_utils functions.
* Add integration tests
Diffstat (limited to 'test/integration/targets/ansible-test-sanity-replace-urlopen')
5 files changed, 27 insertions, 0 deletions
diff --git a/test/integration/targets/ansible-test-sanity-replace-urlopen/aliases b/test/integration/targets/ansible-test-sanity-replace-urlopen/aliases new file mode 100644 index 0000000000..7741d44451 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-replace-urlopen/aliases @@ -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 diff --git a/test/integration/targets/ansible-test-sanity-replace-urlopen/ansible_collections/ns/col/do-not-check-me.py b/test/integration/targets/ansible-test-sanity-replace-urlopen/ansible_collections/ns/col/do-not-check-me.py new file mode 100644 index 0000000000..9b9c7e69c3 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-replace-urlopen/ansible_collections/ns/col/do-not-check-me.py @@ -0,0 +1,5 @@ +import urllib.request + + +def do_stuff(): + urllib.request.urlopen('https://www.ansible.com/') diff --git a/test/integration/targets/ansible-test-sanity-replace-urlopen/ansible_collections/ns/col/plugins/modules/check-me.py b/test/integration/targets/ansible-test-sanity-replace-urlopen/ansible_collections/ns/col/plugins/modules/check-me.py new file mode 100644 index 0000000000..9b9c7e69c3 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-replace-urlopen/ansible_collections/ns/col/plugins/modules/check-me.py @@ -0,0 +1,5 @@ +import urllib.request + + +def do_stuff(): + urllib.request.urlopen('https://www.ansible.com/') diff --git a/test/integration/targets/ansible-test-sanity-replace-urlopen/expected.txt b/test/integration/targets/ansible-test-sanity-replace-urlopen/expected.txt new file mode 100644 index 0000000000..4dd1bfb06e --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-replace-urlopen/expected.txt @@ -0,0 +1 @@ +plugins/modules/check-me.py:5:20: use `ansible.module_utils.urls.open_url` instead of `urlopen` diff --git a/test/integration/targets/ansible-test-sanity-replace-urlopen/runme.sh b/test/integration/targets/ansible-test-sanity-replace-urlopen/runme.sh new file mode 100755 index 0000000000..e6637c5780 --- /dev/null +++ b/test/integration/targets/ansible-test-sanity-replace-urlopen/runme.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -eu + +source ../collection/setup.sh + +set -x + +ansible-test sanity --test replace-urlopen --color --lint --failure-ok "${@}" > actual.txt + +diff -u "${TEST_DIR}/expected.txt" actual.txt +diff -u do-not-check-me.py plugins/modules/check-me.py |