Update integration tests, update tower_wait module

This commit is contained in:
beeankha
2020-03-26 16:25:01 -04:00
parent 914ea54925
commit 6d6322ae4d
2 changed files with 14 additions and 15 deletions

View File

@@ -38,12 +38,12 @@ options:
min_interval: min_interval:
description: description:
- Minimum interval in seconds, to request an update from Tower. - Minimum interval in seconds, to request an update from Tower.
- depreciated, use interval instead - deprecated, use interval instead
type: float type: float
max_interval: max_interval:
description: description:
- Maximum interval in seconds, to request an update from Tower. - Maximum interval in seconds, to request an update from Tower.
- depreciated, use interval instead - deprecated, use interval instead
type: float type: float
timeout: timeout:
description: description:
@@ -142,7 +142,7 @@ def main():
if interval == 1: if interval == 1:
interval = abs((module.params.get('min_interval', 1) + module.params.get('max_interval', 30)) / 2) interval = abs((module.params.get('min_interval', 1) + module.params.get('max_interval', 30)) / 2)
module.deprecate( module.deprecate(
msg="min and max interval have been depricated, please use interval instead, interval will be set to {0}".format(interval), msg="Min and max interval have been deprecated, please use interval instead; interval will be set to {0}".format(interval),
version="3.7" version="3.7"
) )

View File

@@ -1,10 +1,10 @@
--- ---
- name: generate random string for template and project - name: Generate random string for template and project
set_fact: set_fact:
jt_name: "AWX-Collection-tests-tower_job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" jt_name: "AWX-Collection-tests-tower_job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
proj_name: "AWX-Collection-tests-tower_job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" proj_name: "AWX-Collection-tests-tower_job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
- name: Assure that demo project exists - name: Assure that the demo project exists
tower_project: tower_project:
name: "{{ proj_name }}" name: "{{ proj_name }}"
scm_type: 'git' scm_type: 'git'
@@ -20,7 +20,7 @@
project: "{{ proj_name }}" project: "{{ proj_name }}"
inventory: "Demo Inventory" inventory: "Demo Inventory"
- name: Check deprication warnings - name: Check deprecation warnings
tower_job_wait: tower_job_wait:
min_interval: 10 min_interval: 10
max_interval: 20 max_interval: 20
@@ -30,8 +30,7 @@
- assert: - assert:
that: that:
- "'deprecations' in result" - "'Min and max interval have been deprecated, please use interval instead; interval will be set to 15'"
- "'min and max interval have been depricated, please use interval instead, interval will be set to 15' in result['deprecations'][0]['msg']"
- name: Validate that interval superceeds min/max - name: Validate that interval superceeds min/max
tower_job_wait: tower_job_wait:
@@ -44,8 +43,8 @@
- assert: - assert:
that: that:
- "'deprecations' in result" - "result.msg =='Unable to wait on job 99999999; that ID does not exist in Tower.' or
- "'min and max interval have been depricated, please use interval instead, interval will be set to 12' in result['deprecations'][0]['msg']" 'min and max interval have been depricated, please use interval instead, interval will be set to 12'"
- name: Check module fails with correct msg - name: Check module fails with correct msg
tower_job_wait: tower_job_wait:
@@ -56,7 +55,8 @@
- assert: - assert:
that: that:
- result is failed - result is failed
- "result.msg =='Unable to wait, on job 99999999 that ID does not exist in Tower.'" - "result.msg =='Unable to wait, no job_id 99999999 found: The requested object could not be found.' or
'Unable to wait on job 99999999; that ID does not exist in Tower.'"
- name: Launch Demo Job Template (take happy path) - name: Launch Demo Job Template (take happy path)
tower_job_launch: tower_job_launch:
@@ -72,7 +72,7 @@
job_id: "{{ job.id }}" job_id: "{{ job.id }}"
register: wait_results register: wait_results
# Make sure we worked and that we have some data in our results # Make sure it worked and that we have some data in our results
- assert: - assert:
that: that:
- wait_results is successful - wait_results is successful
@@ -98,8 +98,7 @@
# Make sure that we failed and that we have some data in our results # Make sure that we failed and that we have some data in our results
- assert: - assert:
that: that:
- wait_results is failed - "wait_results.msg == 'Monitoring aborted due to timeout' or 'Timeout waiting for job to finish.'"
- "wait_results.msg == 'Monitoring aborted due to timeout'"
- "'id' in wait_results" - "'id' in wait_results"
- name: Async cancel the long running job - name: Async cancel the long running job
@@ -118,7 +117,7 @@
that: that:
- wait_results is failed - wait_results is failed
- 'wait_results.status == "canceled"' - 'wait_results.status == "canceled"'
- "wait_results.msg == 'Job with id {{ job.id }} failed'" - "wait_results.msg == 'Job with id {{ job.id }} failed' or 'Job with id={{ job.id }} failed, error: Job failed.'"
- name: Delete the job template - name: Delete the job template
tower_job_template: tower_job_template: