Make use of Jinja tests 'finished' (#43233)

And also used 'changed' and 'failed' tests while we are at it.
This commit is contained in:
Dag Wieers 2018-07-30 10:41:49 +02:00 committed by GitHub
commit 12e7e9650e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 21 deletions

View file

@ -15,6 +15,7 @@
- asyncresult.ansible_job_id is match('\d+\.\d+')
- asyncresult.started == 1
- asyncresult.finished == 0
- asyncresult is not finished
- asyncresult.results_file is search('\.ansible_async.+\d+\.\d+')
# ensure that async is actually async- this test will fail if # hosts > forks or if the target host is VERY slow
- (lookup('pipe', 'date +%s') | int) - (start_timestamp | int) < 8
@ -31,7 +32,8 @@
that:
- asyncresult.ansible_job_id is match('\d+\.\d+')
- asyncresult.finished == 1
- asyncresult.changed == true
- asyncresult is finished
- asyncresult is changed
- asyncresult.ansible_async_watchdog_pid is number
# - asyncresult.module_tempdir is search('ansible-tmp-')
- asyncresult.module_pid is number
@ -68,7 +70,8 @@
that:
- asyncresult.ansible_job_id is match('\d+\.\d+')
- asyncresult.finished == 1
- asyncresult.changed == true
- asyncresult is finished
- asyncresult is changed
# - asyncresult.module_tempdir is search('ansible-tmp-')
- asyncresult.module_pid is number
@ -105,8 +108,9 @@
that:
- asyncresult.ansible_job_id is match('\d+\.\d+')
- asyncresult.finished == 1
- asyncresult.changed == false
- asyncresult is failed == true
- asyncresult is finished
- asyncresult is not changed
- asyncresult is failed
- asyncresult.msg is search('timed out')
- name: async poll graceful module failure
@ -122,8 +126,9 @@
that:
- asyncresult.ansible_job_id is match('\d+\.\d+')
- asyncresult.finished == 1
- asyncresult.changed == true
- asyncresult is failed == true
- asyncresult is finished
- asyncresult is changed
- asyncresult is failed
- asyncresult.msg == 'failed gracefully'
- name: async poll exception module failure
@ -139,8 +144,9 @@
that:
- asyncresult.ansible_job_id is match('\d+\.\d+')
- asyncresult.finished == 1
- asyncresult.changed == false
- asyncresult is failed == true
- asyncresult is finished
- asyncresult is not changed
- asyncresult is failed
# TODO: re-enable after catastrophic failure behavior is cleaned up
# - asyncresult.msg is search('failing via exception')
@ -184,7 +190,7 @@
# async_status:
# jid: "{{ item }}"
# register: asyncout
# until: asyncout.finished == 1
# until: asyncout is finished
# retries: 10
# delay: 1
# with_items: "{{ async_many.results | map(attribute='ansible_job_id') | list }}"
@ -193,8 +199,9 @@
# assert:
# that:
# - item.finished == 1
# - item is finished
# - item.slept_sec == 3
# - item.changed == true
# - item is changed
# - item.ansible_job_id is match('\d+\.\d+')
# with_items: "{{ asyncout.results }}"