diff options
author | Martin Krizek <martin.krizek@gmail.com> | 2021-06-03 21:17:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-04 05:17:19 +1000 |
commit | 4f3ee4624e8d393576da8bc17d258d9e416b9ffb (patch) | |
tree | c434b59e4d25fdfb739fbdbb8d6f52ed976ee195 /test/integration/targets/meta_tasks | |
parent | ac779114911ec72d4d61478b7091889fa8a01cc9 (diff) | |
download | ansible-4f3ee4624e8d393576da8bc17d258d9e416b9ffb.tar.gz |
Add end_batch meta task (#74899)
* Add end_batch meta task
* Add note
* Fix sanity
Diffstat (limited to 'test/integration/targets/meta_tasks')
-rwxr-xr-x | test/integration/targets/meta_tasks/runme.sh | 9 | ||||
-rw-r--r-- | test/integration/targets/meta_tasks/test_end_batch.yml | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/integration/targets/meta_tasks/runme.sh b/test/integration/targets/meta_tasks/runme.sh index cc951bbba5..f5916ec762 100755 --- a/test/integration/targets/meta_tasks/runme.sh +++ b/test/integration/targets/meta_tasks/runme.sh @@ -56,3 +56,12 @@ for test_strategy in linear free; do grep -q "META: ending play" <<< "$out" grep -qv 'Failed to end using end_play' <<< "$out" done + +# test end_batch meta task +for test_strategy in linear free; do + out="$(ansible-playbook test_end_batch.yml -i inventory.yml -e test_strategy=$test_strategy -vv "$@")" + + [ "$(grep -c "Using end_batch" <<< "$out" )" -eq 2 ] + [ "$(grep -c "META: ending batch" <<< "$out" )" -eq 2 ] + grep -qv 'Failed to end_batch' <<< "$out" +done diff --git a/test/integration/targets/meta_tasks/test_end_batch.yml b/test/integration/targets/meta_tasks/test_end_batch.yml new file mode 100644 index 0000000000..4af020afa3 --- /dev/null +++ b/test/integration/targets/meta_tasks/test_end_batch.yml @@ -0,0 +1,13 @@ +- name: Testing end_batch with strategy {{ test_strategy | default('linear') }} + hosts: testhost:testhost2 + gather_facts: no + serial: 1 + strategy: "{{ test_strategy | default('linear') }}" + tasks: + - debug: + msg: "Using end_batch, current host: {{ inventory_hostname }}, current batch: {{ ansible_play_batch }}" + + - meta: end_batch + + - fail: + msg: "Failed to end_batch, current host: {{ inventory_hostname }}, current batch: {{ ansible_play_batch }}" |