mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-19 23:33:37 -05:00
linting linting again Use the correct role on org permission check Co-authored-by: Elijah DeLee <kdelee@redhat.com> Update docs/bulk_api.md Co-authored-by: Elijah DeLee <kdelee@redhat.com> Update docs/bulk_api.md Co-authored-by: Elijah DeLee <kdelee@redhat.com> Update awx/main/access.py Co-authored-by: Elijah DeLee <kdelee@redhat.com> Update awx/main/access.py Co-authored-by: Elijah DeLee <kdelee@redhat.com> Update docs/bulk_api.md Co-authored-by: Alan Rominger <arominge@redhat.com> fix collection test (#19) improve readability of through model object creation (#18) lower num jobs/hosts in tests (#20) we can test query scaling at lower numbers, to reduce load in tests. We suspect this was causing some flake in the tests on PRs adjust the num of queries
71 lines
1.9 KiB
YAML
71 lines
1.9 KiB
YAML
---
|
|
- 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: True
|
|
inventory: Demo Inventory
|
|
organization: Default
|
|
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
|