Change job_wait collection test to always try and delete created objects

This commit is contained in:
John Westcott IV
2023-05-10 11:08:50 -04:00
parent a66acd87e6
commit cf091d7836

View File

@@ -9,7 +9,8 @@
jt_name: "AWX-Collection-tests-job_wait-long_running-{{ test_id }}" jt_name: "AWX-Collection-tests-job_wait-long_running-{{ test_id }}"
proj_name: "AWX-Collection-tests-job_wait-long_running-{{ test_id }}" proj_name: "AWX-Collection-tests-job_wait-long_running-{{ test_id }}"
- name: Assure that the demo project exists - block:
- name: Create a project
project: project:
name: "{{ proj_name }}" name: "{{ proj_name }}"
scm_type: 'git' scm_type: 'git'
@@ -25,7 +26,7 @@
project: "{{ proj_name }}" project: "{{ proj_name }}"
inventory: "Demo Inventory" inventory: "Demo Inventory"
extra_vars: extra_vars:
sleep_interval: 300 sleep_interval: 600
- name: Check module fails with correct msg - name: Check module fails with correct msg
job_wait: job_wait:
@@ -100,21 +101,6 @@
- 'wait_results.status == "canceled"' - 'wait_results.status == "canceled"'
- "wait_results.msg == 'Job with id {{ job.id }} failed' or 'Job with id={{ job.id }} failed, error: Job 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
job_template:
name: "{{ jt_name }}"
playbook: "sleep.yml"
job_type: run
project: "{{ proj_name }}"
inventory: "Demo Inventory"
state: absent
- name: Delete the project
project:
name: "{{ proj_name }}"
organization: Default
state: absent
# workflow wait test # workflow wait test
- name: Generate a random string for test - name: Generate a random string for test
set_fact: set_fact:
@@ -156,7 +142,23 @@
- "'elapsed' in wait_workflow_results" - "'elapsed' in wait_workflow_results"
- "'id' in wait_workflow_results" - "'id' in wait_workflow_results"
always:
- name: Clean up test workflow - name: Clean up test workflow
workflow_job_template: workflow_job_template:
name: "{{ wfjt_name2 }}" name: "{{ wfjt_name2 }}"
state: absent state: absent
- name: Delete the job template
job_template:
name: "{{ jt_name }}"
playbook: "sleep.yml"
job_type: run
project: "{{ proj_name }}"
inventory: "Demo Inventory"
state: absent
- name: Delete the project
project:
name: "{{ proj_name }}"
organization: Default
state: absent