fixup return values for bulk launch and host create in awxkit

Enabled the params bulk job

make black

make black again

Fixed inventory and organization input params for bulk modules

add collection integration tests

Fix cli return errors

fix test completeness
This commit is contained in:
Elijah DeLee
2023-02-03 10:08:24 -05:00
parent 266ebe5501
commit 9e037f1a02
11 changed files with 365 additions and 42 deletions

View File

@@ -0,0 +1,69 @@
---
- 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 a unique name
set_fact:
bulk_job_name: "AWX-Collection-tests-bulk_job_launch-{{ test_id }}"
- name: Get our collection package
controller_meta:
register: controller_meta
- name: Generate the name of our plugin
set_fact:
plugin_name: "{{ controller_meta.prefix }}.controller_api"
- name: Get Inventory
set_fact:
inventory_id: "{{ lookup(plugin_name, 'inventories', query_params={'name': 'Demo Inventory'}, return_ids=True ) }}"
- name: Create a Job Template
job_template:
name: "{{ bulk_job_name }}"
copy_from: "Demo Job Template"
ask_variables_on_launch: true
ask_inventory_on_launch: true
ask_skip_tags_on_launch: true
allow_simultaneous: true
state: present
register: jt_result
- name: Create Bulk Job
bulk_job_launch:
name: "{{ bulk_job_name }}"
jobs:
- unified_job_template: "{{ jt_result.id }}"
inventory: "{{ inventory_id }}"
skip_tags: "skipfoo,skipbar"
extra_data:
animal: fish
color: orange
- unified_job_template: "{{ jt_result.id }}"
extra_vars:
animal: bear
food: carrot
skip_tags: "skipbaz"
job_tags: "Hello World"
limit: "localhost"
wait: False
inventory: "{{ inventory_id }}"
register: result
- assert:
that:
- result is not failed
- "'id' in result"
- result['job_info']['skip_tags'] == "skipbaz"
- result['job_info']['limit'] == "localhost"
- result['job_info']['job_tags'] == "Hello World"
- result['job_info']['inventory'] == {{ inventory_id }}
- "result['job_info']['extra_vars'] == '{\"animal\": \"bear\", \"food\": \"carrot\"}'"
# cleanup
- name: Delete Job Template
job_template:
name: "{{ bulk_job_name }}"
state: absent