Initial commit of tests for tower_workflow_launch

This commit is contained in:
John Westcott IV
2020-04-01 13:15:04 -04:00
committed by beeankha
parent 907da2ae61
commit a2d1c32da3
2 changed files with 193 additions and 78 deletions

View File

@@ -0,0 +1,75 @@
- name: Generate a random string for test
set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined
- name: Generate names
set_fact:
wfjt_name1: "Testing Workflow Job Launch" #"AWX-Collection-tests-tower_workflow_launch--wfjt1-{{ test_id }}"
- name: Create our workflow
tower_workflow_job_template:
name: "{{ wfjt_name1 }}"
state: present
- name: Add a node
tower_workflow_job_template_node:
workflow_job_template: "{{ wfjt_name1 }}"
unified_job_template: "Demo Job Template"
identifier: leaf
register: new_node
- name: Connect to Tower server but request an invalid workflow
tower_workflow_launch:
validate_certs: False
workflow_template: "Does Not Exist"
ignore_errors: true
register: result
- assert:
that:
- result is failed
- "'Unable to find workflow job template' in result.msg"
- name: Run the workflow without waiting (this should just give us back a job ID)
tower_workflow_launch:
validate_certs: False
workflow_template: "{{ wfjt_name1 }}"
wait: False
ignore_errors: True
register: result
- assert:
that:
- result is not failed
- "'id' in result['job_info']"
- name: Kick off a workflow and wait for it
tower_workflow_launch:
validate_certs: False
workflow_template: "{{ wfjt_name1 }}"
ignore_errors: True
register: result
- assert:
that:
- result is not failed
- "'id' in result['job_info']"
- name: Kick off a workflow and wait for it, but only for a second
tower_workflow_launch:
validate_certs: False
workflow_template: "{{ wfjt_name1 }}"
timeout: 1
ignore_errors: True
register: result
- assert:
that:
- result is failed
- "'Monitoring aborted due to timeout' in result.msg"
- name: Cleanup workflow
tower_workflow_job_template:
name: "{{ wfjt_name1 }}"
state: absent