diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml index f7ffe9bc97..7cdb7457d1 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_cancel/tasks/main.yml @@ -46,27 +46,24 @@ that: - "command is changed" -- name: Timeout waiting for the command to cancel +- name: Cancel the command ad_hoc_command_cancel: command_id: "{{ command.id }}" - timeout: -1 register: results ignore_errors: true - assert: that: - - results is failed - - "results['msg'] == 'Monitoring of ad hoc command aborted due to timeout'" + - results is changed -- block: - - name: "Wait for up to a minute until the job enters the can_cancel: False state" - debug: - msg: "The job can_cancel status has transitioned into False, we can proceed with testing" - until: not job_status - retries: 6 - delay: 10 - vars: - job_status: "{{ lookup('awx.awx.controller_api', 'ad_hoc_commands/'+ command.id | string +'/cancel')['can_cancel'] }}" +- name: "Wait for up to a minute until the job enters the can_cancel: False state" + debug: + msg: "The job can_cancel status has transitioned into False, we can proceed with testing" + until: not job_status + retries: 6 + delay: 10 + vars: + job_status: "{{ lookup('awx.awx.controller_api', 'ad_hoc_commands/'+ command.id | string +'/cancel')['can_cancel'] }}" - name: Cancel the command with hard error if it's not running ad_hoc_command_cancel: diff --git a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml index 941774874f..4e0f8ed5df 100644 --- a/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/ad_hoc_command_wait/tasks/main.yml @@ -108,9 +108,8 @@ - assert: that: - - wait_results is failed - - 'wait_results.status == "canceled"' - - "wait_results.msg == 'The ad hoc command - {{ command.id }}, failed'" + - wait_results is successful + - 'wait_results.status == "successful"' - name: Delete the Credential credential: diff --git a/awx_collection/tests/integration/targets/application/tasks/main.yml b/awx_collection/tests/integration/targets/application/tasks/main.yml index ba76763a41..54fbe47b34 100644 --- a/awx_collection/tests/integration/targets/application/tasks/main.yml +++ b/awx_collection/tests/integration/targets/application/tasks/main.yml @@ -2,6 +2,7 @@ - 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 names set_fact: diff --git a/awx_collection/tests/integration/targets/credential_type/tasks/main.yml b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml index e3b75f7654..ee6045ea50 100644 --- a/awx_collection/tests/integration/targets/credential_type/tasks/main.yml +++ b/awx_collection/tests/integration/targets/credential_type/tasks/main.yml @@ -1,7 +1,12 @@ --- +- 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 names set_fact: - cred_type_name: "AWX-Collection-tests-credential_type-cred-type-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + cred_type_name: "AWX-Collection-tests-credential_type-cred-type-{{ test_id }}" - block: - name: Add Tower credential type diff --git a/awx_collection/tests/integration/targets/group/tasks/main.yml b/awx_collection/tests/integration/targets/group/tasks/main.yml index ac58826b17..3200acbb96 100644 --- a/awx_collection/tests/integration/targets/group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/group/tasks/main.yml @@ -1,13 +1,18 @@ --- +- 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 names set_fact: - group_name1: "AWX-Collection-tests-group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - group_name2: "AWX-Collection-tests-group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - group_name3: "AWX-Collection-tests-group-group-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - inv_name: "AWX-Collection-tests-group-inv-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - host_name1: "AWX-Collection-tests-group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - host_name2: "AWX-Collection-tests-group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - host_name3: "AWX-Collection-tests-group-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + group_name1: "AWX-Collection-tests-group-group1-{{ test_id }}" + group_name2: "AWX-Collection-tests-group-group2-{{ test_id }}" + group_name3: "AWX-Collection-tests-group-group3-{{ test_id }}" + inv_name: "AWX-Collection-tests-group-inv-{{ test_id }}" + host_name1: "AWX-Collection-tests-group-host1-{{ test_id }}" + host_name2: "AWX-Collection-tests-group-host2-{{ test_id }}" + host_name3: "AWX-Collection-tests-group-host3-{{ test_id }}" - name: Create an Inventory inventory: @@ -117,9 +122,10 @@ state: absent register: result +# In this case, group 2 was last a child of group1 so deleting group1 deleted group2 - assert: that: - - "result is changed" + - "result is not changed" - name: Delete a Group group: diff --git a/awx_collection/tests/integration/targets/host/tasks/main.yml b/awx_collection/tests/integration/targets/host/tasks/main.yml index a0321b09cb..6c1fefdf91 100644 --- a/awx_collection/tests/integration/targets/host/tasks/main.yml +++ b/awx_collection/tests/integration/targets/host/tasks/main.yml @@ -1,8 +1,13 @@ --- +- 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 names set_fact: - host_name: "AWX-Collection-tests-host-host-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - inv_name: "AWX-Collection-tests-host-inv-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + host_name: "AWX-Collection-tests-host-host-{{ test_id }}" + inv_name: "AWX-Collection-tests-host-inv-{{ test_id }}" - name: Create an Inventory inventory: diff --git a/awx_collection/tests/integration/targets/instance/tasks/main.yml b/awx_collection/tests/integration/targets/instance/tasks/main.yml index e312c5face..36ff0a138e 100644 --- a/awx_collection/tests/integration/targets/instance/tasks/main.yml +++ b/awx_collection/tests/integration/targets/instance/tasks/main.yml @@ -1,14 +1,25 @@ --- +- 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.{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}.example.com" - hostname2: "AWX-Collection-tests-instance2.{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}.example.com" - hostname3: "AWX-Collection-tests-instance3.{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}.example.com" + 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: Show hostnames - debug: - var: 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 @@ -57,3 +68,5 @@ - "{{ hostname1 }}" - "{{ hostname2 }}" - "{{ hostname3 }}" + + when: IS_K8S diff --git a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml index 701137f28c..e360cf933a 100644 --- a/awx_collection/tests/integration/targets/instance_group/tasks/main.yml +++ b/awx_collection/tests/integration/targets/instance_group/tasks/main.yml @@ -2,6 +2,7 @@ - name: Generate test id set_fact: test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + when: test_id is not defined - name: Generate names set_fact: diff --git a/awx_collection/tests/integration/targets/inventory/tasks/main.yml b/awx_collection/tests/integration/targets/inventory/tasks/main.yml index abbe4f659f..cec0c6b27a 100644 --- a/awx_collection/tests/integration/targets/inventory/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory/tasks/main.yml @@ -2,6 +2,7 @@ - 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 names set_fact: diff --git a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml index d905d03a97..40ffd8c9b2 100644 --- a/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source/tasks/main.yml @@ -1,9 +1,14 @@ --- +- 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 names set_fact: - openstack_cred: "AWX-Collection-tests-inventory_source-cred-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - openstack_inv: "AWX-Collection-tests-inventory_source-inv-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - openstack_inv_source: "AWX-Collection-tests-inventory_source-inv-source-openstack-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + openstack_cred: "AWX-Collection-tests-inventory_source-cred-openstack-{{ test_id }}" + openstack_inv: "AWX-Collection-tests-inventory_source-inv-openstack-{{ test_id }}" + openstack_inv_source: "AWX-Collection-tests-inventory_source-inv-source-openstack-{{ test_id }}" - name: Add a credential credential: diff --git a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml index bc9182bb68..ba0c659544 100644 --- a/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/inventory_source_update/tasks/main.yml @@ -2,6 +2,7 @@ - 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 names set_fact: diff --git a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml index 843c5c96f2..23e43cf422 100644 --- a/awx_collection/tests/integration/targets/job_launch/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_launch/tasks/main.yml @@ -1,9 +1,14 @@ --- +- 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 names set_fact: - jt_name1: "AWX-Collection-tests-job_launch-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - jt_name2: "AWX-Collection-tests-job_launch-jt2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - proj_name: "AWX-Collection-tests-job_launch-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + jt_name1: "AWX-Collection-tests-job_launch-jt1-{{ test_id }}" + jt_name2: "AWX-Collection-tests-job_launch-jt2-{{ test_id }}" + proj_name: "AWX-Collection-tests-job_launch-project-{{ test_id }}" - name: Launch a Job Template job_launch: diff --git a/awx_collection/tests/integration/targets/job_template/tasks/main.yml b/awx_collection/tests/integration/targets/job_template/tasks/main.yml index 951fe27f9a..6269a0b142 100644 --- a/awx_collection/tests/integration/targets/job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_template/tasks/main.yml @@ -2,6 +2,7 @@ - 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 random string for project set_fact: diff --git a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml index 0aac7f314c..ada0e1106b 100644 --- a/awx_collection/tests/integration/targets/job_wait/tasks/main.yml +++ b/awx_collection/tests/integration/targets/job_wait/tasks/main.yml @@ -1,8 +1,13 @@ --- +- 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 random string for template and project set_fact: - jt_name: "AWX-Collection-tests-job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - proj_name: "AWX-Collection-tests-job_wait-long_running-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + jt_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 project: diff --git a/awx_collection/tests/integration/targets/label/tasks/main.yml b/awx_collection/tests/integration/targets/label/tasks/main.yml index 0ac077f8ca..8b3f29171d 100644 --- a/awx_collection/tests/integration/targets/label/tasks/main.yml +++ b/awx_collection/tests/integration/targets/label/tasks/main.yml @@ -1,7 +1,12 @@ --- +- 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 names set_fact: - label_name: "AWX-Collection-tests-label-label-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + label_name: "AWX-Collection-tests-label-label-{{ test_id }}" - name: Create a Label label: diff --git a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml index 5abed9dcd4..511dc72755 100644 --- a/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml +++ b/awx_collection/tests/integration/targets/lookup_api_plugin/tasks/main.yml @@ -101,6 +101,9 @@ set_fact: users: "{{ query(plugin_name, 'users', query_params={ 'username__endswith': test_id, 'page_size': 2 }, return_ids=True ) }}" + - debug: + msg: "{{ users }}" + - name: Assert that user list has 2 ids only and that they are strings, not ints assert: that: diff --git a/awx_collection/tests/integration/targets/notification_template/tasks/main.yml b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml index 278845696f..b909a98299 100644 --- a/awx_collection/tests/integration/targets/notification_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/notification_template/tasks/main.yml @@ -1,12 +1,17 @@ --- +- 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 names set_fact: - slack_not: "AWX-Collection-tests-notification_template-slack-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - webhook_not: "AWX-Collection-tests-notification_template-wehbook-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - email_not: "AWX-Collection-tests-notification_template-email-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - twillo_not: "AWX-Collection-tests-notification_template-twillo-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - pd_not: "AWX-Collection-tests-notification_template-pd-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - irc_not: "AWX-Collection-tests-notification_template-irc-not-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + slack_not: "AWX-Collection-tests-notification_template-slack-not-{{ test_id }}" + webhook_not: "AWX-Collection-tests-notification_template-wehbook-not-{{ test_id }}" + email_not: "AWX-Collection-tests-notification_template-email-not-{{ test_id }}" + twillo_not: "AWX-Collection-tests-notification_template-twillo-not-{{ test_id }}" + pd_not: "AWX-Collection-tests-notification_template-pd-not-{{ test_id }}" + irc_not: "AWX-Collection-tests-notification_template-irc-not-{{ test_id }}" - name: Create Slack notification with custom messages notification_template: diff --git a/awx_collection/tests/integration/targets/organization/tasks/main.yml b/awx_collection/tests/integration/targets/organization/tasks/main.yml index fcf34e472d..baa7fb733f 100644 --- a/awx_collection/tests/integration/targets/organization/tasks/main.yml +++ b/awx_collection/tests/integration/targets/organization/tasks/main.yml @@ -2,6 +2,7 @@ - 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 an org name set_fact: diff --git a/awx_collection/tests/integration/targets/project/tasks/main.yml b/awx_collection/tests/integration/targets/project/tasks/main.yml index 3a8889ee2c..89d6f36885 100644 --- a/awx_collection/tests/integration/targets/project/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project/tasks/main.yml @@ -1,13 +1,18 @@ --- +- 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 names set_fact: - project_name1: "AWX-Collection-tests-project-project1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - project_name2: "AWX-Collection-tests-project-project2-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - project_name3: "AWX-Collection-tests-project-project3-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - jt1: "AWX-Collection-tests-project-jt1-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - scm_cred_name: "AWX-Collection-tests-project-scm-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - org_name: "AWX-Collection-tests-project-org-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - cred_name: "AWX-Collection-tests-project-cred-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + project_name1: "AWX-Collection-tests-project-project1-{{ test_id }}" + project_name2: "AWX-Collection-tests-project-project2-{{ test_id }}" + project_name3: "AWX-Collection-tests-project-project3-{{ test_id }}" + jt1: "AWX-Collection-tests-project-jt1-{{ test_id }}" + scm_cred_name: "AWX-Collection-tests-project-scm-cred-{{ test_id }}" + org_name: "AWX-Collection-tests-project-org-{{ test_id }}" + cred_name: "AWX-Collection-tests-project-cred-{{ test_id }}" - block: - name: Create an SCM Credential diff --git a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml index 9fb9607258..3d4256a527 100644 --- a/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml +++ b/awx_collection/tests/integration/targets/project_manual/tasks/create_project_dir.yml @@ -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 diff --git a/awx_collection/tests/integration/targets/project_manual/tasks/main.yml b/awx_collection/tests/integration/targets/project_manual/tasks/main.yml index 3cd328b4f0..5f45b4d0a9 100644 --- a/awx_collection/tests/integration/targets/project_manual/tasks/main.yml +++ b/awx_collection/tests/integration/targets/project_manual/tasks/main.yml @@ -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 diff --git a/awx_collection/tests/integration/targets/role/tasks/main.yml b/awx_collection/tests/integration/targets/role/tasks/main.yml index a94f534134..449b402321 100644 --- a/awx_collection/tests/integration/targets/role/tasks/main.yml +++ b/awx_collection/tests/integration/targets/role/tasks/main.yml @@ -2,6 +2,7 @@ - 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 names set_fact: diff --git a/awx_collection/tests/integration/targets/schedule/tasks/main.yml b/awx_collection/tests/integration/targets/schedule/tasks/main.yml index 73343faf94..6bde226fcc 100644 --- a/awx_collection/tests/integration/targets/schedule/tasks/main.yml +++ b/awx_collection/tests/integration/targets/schedule/tasks/main.yml @@ -2,6 +2,7 @@ - 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 random string for schedule set_fact: diff --git a/awx_collection/tests/integration/targets/team/tasks/main.yml b/awx_collection/tests/integration/targets/team/tasks/main.yml index f220d9194f..390a888610 100644 --- a/awx_collection/tests/integration/targets/team/tasks/main.yml +++ b/awx_collection/tests/integration/targets/team/tasks/main.yml @@ -1,7 +1,12 @@ --- +- 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 names set_fact: - team_name: "AWX-Collection-tests-team-team-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + team_name: "AWX-Collection-tests-team-team-{{ test_id }}" - name: Attempt to add a team to a non-existant Organization team: diff --git a/awx_collection/tests/integration/targets/token/tasks/main.yml b/awx_collection/tests/integration/targets/token/tasks/main.yml index f13bc6bc66..9cd4972a93 100644 --- a/awx_collection/tests/integration/targets/token/tasks/main.yml +++ b/awx_collection/tests/integration/targets/token/tasks/main.yml @@ -1,7 +1,12 @@ --- +- 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 names set_fact: - token_description: "AWX-Collection-tests-token-description-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + token_description: "AWX-Collection-tests-token-description-{{ test_id }}" - name: Try to use a token as a dict which is missing the token parameter job_list: diff --git a/awx_collection/tests/integration/targets/user/tasks/main.yml b/awx_collection/tests/integration/targets/user/tasks/main.yml index 1d5cc5de5e..6d2b290dd6 100644 --- a/awx_collection/tests/integration/targets/user/tasks/main.yml +++ b/awx_collection/tests/integration/targets/user/tasks/main.yml @@ -1,7 +1,12 @@ --- +- 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 names set_fact: - username: "AWX-Collection-tests-user-user-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + username: "AWX-Collection-tests-user-user-{{ test_id }}" - name: Create a User user: @@ -131,10 +136,6 @@ 'Can not verify ssl with non-https protocol' in result.exception" - block: - - name: Generate a test ID - set_fact: - test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - - name: Generate an org name set_fact: org_name: "AWX-Collection-tests-organization-org-{{ test_id }}" diff --git a/awx_collection/tests/integration/targets/workflow_approval/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_approval/tasks/main.yml index eaf1b3bf8d..52fb7585c2 100644 --- a/awx_collection/tests/integration/targets/workflow_approval/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_approval/tasks/main.yml @@ -2,13 +2,15 @@ - name: Generate a random string for names set_fact: test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - test_prefix: AWX-Collection-tests-workflow_approval + when: test_id is not defined - name: Generate random names for test objects set_fact: org_name: "{{ test_prefix }}-org-{{ test_id }}" approval_node_name: "{{ test_prefix }}-node-{{ test_id }}" wfjt_name: "{{ test_prefix }}-wfjt-{{ test_id }}" + vars: + test_prefix: AWX-Collection-tests-workflow_approval - block: - name: Create a new organization for test isolation diff --git a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml index e5f3366cd3..dc15afb428 100644 --- a/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml +++ b/awx_collection/tests/integration/targets/workflow_job_template/tasks/main.yml @@ -2,6 +2,7 @@ - name: Generate a random string for names set_fact: test_id: "{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + when: test_id is not defined - name: Generate random names for test objects set_fact: @@ -17,8 +18,8 @@ webhook_wfjt_name: "AWX-Collection-tests-workflow_job_template-webhook-wfjt-{{ test_id }}" email_not: "AWX-Collection-tests-job_template-email-not-{{ test_id }}" webhook_notification: "AWX-Collection-tests-notification_template-wehbook-not-{{ test_id }}" - project_inv: "AWX-Collection-tests-inventory_source-inv-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" - project_inv_source: "AWX-Collection-tests-inventory_source-inv-source-project-{{ lookup('password', '/dev/null chars=ascii_letters length=16') }}" + project_inv: "AWX-Collection-tests-inventory_source-inv-project-{{ test_id }}" + project_inv_source: "AWX-Collection-tests-inventory_source-inv-source-project-{{ test_id }}" github_webhook_credential_name: "AWX-Collection-tests-credential-webhook-{{ test_id }}_github" ee1: "AWX-Collection-tests-workflow_job_template-ee1-{{ test_id }}" label1: "AWX-Collection-tests-workflow_job_template-l1-{{ test_id }}"