Files
awx/awx_collection/tests/integration/targets/instance/tasks/main.yml
John Westcott IV b87ff45c07 Enhance collection test
ad_hoc_command_cancel really can no longer timeout on a cancel (it happens sub second) and remove unneeded block

Modified all test to respect test_id parameter so that all tests can be run togeather as a single ID

Fix a check in group since its group2 is deleted from being a sub group of group1

The UI now allows to propage sub groups to the inventory which we may want to support within the collection

Only run instance integration test if we are running on k8s and assume we are not by default

Fix hard coded names in manual_project
2023-04-25 13:48:37 -04:00

73 lines
1.8 KiB
YAML

---
- name: Generate a test ID
set_fact:
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined
- name: Generate hostnames
set_fact:
hostname1: "AWX-Collection-tests-instance1.{{ test_id }}.example.com"
hostname2: "AWX-Collection-tests-instance2.{{ test_id }}.example.com"
hostname3: "AWX-Collection-tests-instance3.{{ test_id }}.example.com"
register: facts
- name: Get the k8s setting
set_fact:
IS_K8S: "{{ controller_settings['IS_K8S'] | default(False) }}"
vars:
controller_settings: "{{ lookup('awx.awx.controller_api', 'settings/all') }}"
- debug:
msg: "Skipping instance test since this is instance is not running on a K8s platform"
when: not IS_K8S
- block:
- name: Create an instance
awx.awx.instance:
hostname: "{{ item }}"
node_type: execution
node_state: installed
with_items:
- "{{ hostname1 }}"
- "{{ hostname2 }}"
register: result
- assert:
that:
- result is changed
- name: Create an instance with non-default config
awx.awx.instance:
hostname: "{{ hostname3 }}"
node_type: execution
node_state: installed
capacity_adjustment: 0.4
listener_port: 31337
register: result
- assert:
that:
- result is changed
- name: Update an instance
awx.awx.instance:
hostname: "{{ hostname1 }}"
capacity_adjustment: 0.7
register: result
- assert:
that:
- result is changed
always:
- name: Deprovision the instances
awx.awx.instance:
hostname: "{{ item }}"
node_state: deprovisioning
with_items:
- "{{ hostname1 }}"
- "{{ hostname2 }}"
- "{{ hostname3 }}"
when: IS_K8S