diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/infra/runme.sh | |
parent | Initial commit. (diff) | |
download | ansible-core-upstream/2.14.3.tar.xz ansible-core-upstream/2.14.3.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | test/integration/targets/infra/runme.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/integration/targets/infra/runme.sh b/test/integration/targets/infra/runme.sh new file mode 100755 index 0000000..9e348b8 --- /dev/null +++ b/test/integration/targets/infra/runme.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +set -ux + +# ensure fail/assert work locally and can stop execution with non-zero exit code +PB_OUT=$(ansible-playbook -i inventory.local test_test_infra.yml) +APB_RC=$? +echo "$PB_OUT" +echo "rc was $APB_RC (must be non-zero)" +[ ${APB_RC} -ne 0 ] +echo "ensure playbook output shows assert/fail works (True)" +echo "$PB_OUT" | grep -F "fail works (True)" || exit 1 +echo "$PB_OUT" | grep -F "assert works (True)" || exit 1 + +# ensure we work using all specified test args, overridden inventory, etc +PB_OUT=$(ansible-playbook -i ../../inventory test_test_infra.yml "$@") +APB_RC=$? +echo "$PB_OUT" +echo "rc was $APB_RC (must be non-zero)" +[ ${APB_RC} -ne 0 ] +echo "ensure playbook output shows assert/fail works (True)" +echo "$PB_OUT" | grep -F "fail works (True)" || exit 1 +echo "$PB_OUT" | grep -F "assert works (True)" || exit 1 + +set -e + +PING_MODULE_PATH="../../../../lib/ansible/modules/ping.py" + +# ensure test-module.py script works without passing Python interpreter path +../../../../hacking/test-module.py -m "$PING_MODULE_PATH" + +# ensure test-module.py script works well +../../../../hacking/test-module.py -m "$PING_MODULE_PATH" -I ansible_python_interpreter="${ANSIBLE_TEST_PYTHON_INTERPRETER}" + +# ensure module.ansible_version is defined when using test-module.py +../../../../hacking/test-module.py -m library/test.py -I ansible_python_interpreter="${ANSIBLE_TEST_PYTHON_INTERPRETER}" <<< '{"ANSIBLE_MODULE_ARGS": {}}' + +# ensure exercising module code locally works +python -m ansible.modules.file <<< '{"ANSIBLE_MODULE_ARGS": {"path": "/path/to/file", "state": "absent"}}' |