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/include_when_parent_is_static | |
parent | Initial commit. (diff) | |
download | ansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/include_when_parent_is_static')
5 files changed, 32 insertions, 0 deletions
diff --git a/test/integration/targets/include_when_parent_is_static/aliases b/test/integration/targets/include_when_parent_is_static/aliases new file mode 100644 index 0000000..1d28bdb --- /dev/null +++ b/test/integration/targets/include_when_parent_is_static/aliases @@ -0,0 +1,2 @@ +shippable/posix/group5 +context/controller diff --git a/test/integration/targets/include_when_parent_is_static/playbook.yml b/test/integration/targets/include_when_parent_is_static/playbook.yml new file mode 100644 index 0000000..6189873 --- /dev/null +++ b/test/integration/targets/include_when_parent_is_static/playbook.yml @@ -0,0 +1,4 @@ +- hosts: localhost + gather_facts: no + tasks: + - import_tasks: tasks.yml diff --git a/test/integration/targets/include_when_parent_is_static/runme.sh b/test/integration/targets/include_when_parent_is_static/runme.sh new file mode 100755 index 0000000..0b66f6b --- /dev/null +++ b/test/integration/targets/include_when_parent_is_static/runme.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -eux + +ansible-playbook playbook.yml "$@" > output.log 2>&1 || true + +if grep "intentional syntax error" output.log >/dev/null; then + echo "Test passed (playbook failed with expected output, output not shown)." + exit 0 +fi + +cat output.log +exit 1 diff --git a/test/integration/targets/include_when_parent_is_static/syntax_error.yml b/test/integration/targets/include_when_parent_is_static/syntax_error.yml new file mode 100644 index 0000000..e1a629c --- /dev/null +++ b/test/integration/targets/include_when_parent_is_static/syntax_error.yml @@ -0,0 +1 @@ +intentional syntax error which SHOULD be encountered diff --git a/test/integration/targets/include_when_parent_is_static/tasks.yml b/test/integration/targets/include_when_parent_is_static/tasks.yml new file mode 100644 index 0000000..a234a3d --- /dev/null +++ b/test/integration/targets/include_when_parent_is_static/tasks.yml @@ -0,0 +1,12 @@ +# intentionally stop execution of the play before reaching the include below +# if the include is static as expected it will trigger a syntax error +# however, if the include is dynamic a syntax error will not occur +- name: EXPECTED SUCCESS + fail: + msg: + This task should never execute. + The playbook should have failed due to a syntax error in 'syntax_error.yml' when attempting a static include of that file. + +# perform an include task which should be static if all of the task's parents are static, otherwise it should be dynamic +# this file was loaded using import_tasks, which is static, so this include should also be static +- include: syntax_error.yml |