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
This commit is contained in:
John Westcott IV
2023-04-25 13:48:37 -04:00
parent 7acc0067f5
commit b87ff45c07
28 changed files with 173 additions and 80 deletions

View File

@@ -2,22 +2,25 @@
- name: Load the UI settings
set_fact:
project_base_dir: "{{ controller_settings.project_base_dir }}"
inv_name: "AWX-Collection-tests-manual_project-inv-{{ test_id }}"
host_name: "AWX-Collection-tests-manual_project-host-{{ test_id }}"
cred_name: "AWX-Collection-tests-manual_project-cred-{{ test_id }}"
vars:
controller_settings: "{{ lookup('awx.awx.controller_api', 'config/') }}"
- inventory:
name: localhost
name: "{{ inv_name }}"
organization: Default
- host:
name: localhost
inventory: localhost
name: "{{ host_name }}"
inventory: "{{ inv_name }}"
variables:
ansible_connection: local
- name: Create an unused SSH / Machine credential
credential:
name: dummy
name: "{{ cred_name }}"
credential_type: Machine
inputs:
ssh_key_data: |
@@ -36,8 +39,8 @@
- name: Create a directory for manual project
ad_hoc_command:
credential: dummy
inventory: localhost
credential: "{{ cred_name }}"
inventory: "{{ inv_name }}"
job_type: run
module_args: "mkdir -p {{ project_base_dir }}/{{ project_dir_name }}"
module_name: command
@@ -51,6 +54,18 @@
- name: Delete dummy credential
credential:
name: dummy
name: "{{ cred_name }}"
credential_type: Machine
state: absent
- name: Delete host
host:
name: "{{ host_name }}"
inventory: "{{ inv_name }}"
state: absent
- name: Delete Inventory
inventory:
name: "{{ inv_name }}"
organization: Default
state: absent

View File

@@ -1,15 +1,13 @@
---
- name: Generate random string for project
- name: Generate a test ID
set_fact:
rand_string: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}"
when: test_id is not defined
- name: Generate manual project name
- name: Generate object names
set_fact:
project_name: "Manual_Project_{{ rand_string }}"
- name: Generate manual project dir name
set_fact:
project_dir_name: "proj_{{ rand_string }}"
project_name: "AWX-Collection-tests-manual_project-proj-{{ test_id }}"
project_dir_name: "proj_{{ test_id }}"
- name: Create a project directory for manual project
import_tasks: create_project_dir.yml