From 227f498314eb5d0189fa6fb128825c859ce38739 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Thu, 13 Feb 2020 16:22:24 -0800 Subject: [PATCH] stable-2.9: Restore Tower integration tests. (#67395) * Move tower_common tests with tower_organization. (cherry picked from commit c92697aceccc9d849affcc2ab2f849c96974a7aa) * Test: Bump TOWER_VERSION to supported version (#67378) * Revert "Remove Tower module tests from CI. (#67368)" This reverts commit b041d9676246f2aa8258c078d673cb9bb39044b8. * Test: Bump TOWER_VERSION to 3.6.2 (cherry picked from commit b9bd2c25ca97ce647885f07b1d7596f75eb7d701) Co-authored-by: Yanis Guenane --- shippable.yml | 3 ++ test/integration/targets/tower_common/aliases | 2 - .../targets/tower_common/tasks/main.yml | 47 ------------------- .../targets/tower_credential/aliases | 2 +- .../targets/tower_credential_type/aliases | 2 +- test/integration/targets/tower_group/aliases | 2 +- test/integration/targets/tower_host/aliases | 2 +- .../targets/tower_inventory/aliases | 2 +- .../targets/tower_inventory_source/aliases | 2 +- .../targets/tower_job_cancel/aliases | 2 +- .../targets/tower_job_launch/aliases | 2 +- .../targets/tower_job_list/aliases | 2 +- .../targets/tower_job_template/aliases | 2 +- .../targets/tower_job_wait/aliases | 2 +- test/integration/targets/tower_label/aliases | 2 +- .../targets/tower_notification/aliases | 2 +- .../targets/tower_organization/aliases | 2 +- .../targets/tower_organization/tasks/main.yml | 31 ++++++++++++ .../integration/targets/tower_project/aliases | 2 +- .../tasks/create_project_dir.yml | 1 + .../integration/targets/tower_receive/aliases | 2 +- test/integration/targets/tower_role/aliases | 2 +- .../targets/tower_role/tasks/main.yml | 8 ---- test/integration/targets/tower_send/aliases | 2 +- .../targets/tower_settings/aliases | 2 +- test/integration/targets/tower_team/aliases | 2 +- test/integration/targets/tower_user/aliases | 2 +- .../targets/tower_workflow_launch/aliases | 2 +- .../tower_workflow_launch/tasks/main.yml | 5 ++ .../targets/tower_workflow_template/aliases | 2 +- .../lib/ansible_test/_internal/cloud/tower.py | 6 ++- 31 files changed, 68 insertions(+), 81 deletions(-) delete mode 100644 test/integration/targets/tower_common/aliases delete mode 100644 test/integration/targets/tower_common/tasks/main.yml diff --git a/shippable.yml b/shippable.yml index 44dc6257400..e1ef5fa5210 100644 --- a/shippable.yml +++ b/shippable.yml @@ -163,6 +163,9 @@ matrix: - env: T=cs/2.7/1 - env: T=cs/3.6/1 + - env: T=tower/2.7/1 + - env: T=tower/3.6/1 + - env: T=cloud/2.7/1 - env: T=cloud/3.6/1 diff --git a/test/integration/targets/tower_common/aliases b/test/integration/targets/tower_common/aliases deleted file mode 100644 index 350a0410424..00000000000 --- a/test/integration/targets/tower_common/aliases +++ /dev/null @@ -1,2 +0,0 @@ -cloud/tower -unsupported diff --git a/test/integration/targets/tower_common/tasks/main.yml b/test/integration/targets/tower_common/tasks/main.yml deleted file mode 100644 index 6cef98f5368..00000000000 --- a/test/integration/targets/tower_common/tasks/main.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Test behaviour common to all tower modules -- name: Check that SSL is available - tower_organization: - name: Default - register: result - -- name: Check we haven't changed anything - assert: - that: result is not changed - -- name: Check that SSL is available and verify_ssl is enabled (task must fail) - tower_organization: - name: Default - environment: - TOWER_CERTIFICATE: /dev/null # force check failure - ignore_errors: true - register: check_ssl_is_used - -- name: Check that connection failed - assert: - that: - - check_ssl_is_used is failed - - > - 'Could not establish a secure connection' in (check_ssl_is_used.module_stderr + check_ssl_is_used.module_stdout) - or 'OpenSSL.SSL.Error' in (check_ssl_is_used.module_stderr + check_ssl_is_used.module_stdout) - # 'Could not establish a secure connection': when pyOpenSSL isn't available - # 'OpenSSL.SSL.Error': with pyOpenSSL, see https://github.com/urllib3/urllib3/pull/1517 - -- name: Disable verify_ssl in ~/.tower_cli.cfg - copy: - dest: ~/.tower_cli.cfg - content: | - [general] - verify_ssl = False - force: false # ensure remote file doesn't exist - -- block: - - name: Check that verify_ssl is disabled (task must not fail) - tower_organization: - name: Default - environment: - TOWER_CERTIFICATE: /dev/null # should not fail because verify_ssl is disabled - always: - - name: Delete ~/.tower_cli.cfg - file: - path: ~/.tower_cli.cfg - state: absent diff --git a/test/integration/targets/tower_credential/aliases b/test/integration/targets/tower_credential/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_credential/aliases +++ b/test/integration/targets/tower_credential/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_credential_type/aliases b/test/integration/targets/tower_credential_type/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_credential_type/aliases +++ b/test/integration/targets/tower_credential_type/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_group/aliases b/test/integration/targets/tower_group/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_group/aliases +++ b/test/integration/targets/tower_group/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_host/aliases b/test/integration/targets/tower_host/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_host/aliases +++ b/test/integration/targets/tower_host/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_inventory/aliases b/test/integration/targets/tower_inventory/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_inventory/aliases +++ b/test/integration/targets/tower_inventory/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_inventory_source/aliases b/test/integration/targets/tower_inventory_source/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_inventory_source/aliases +++ b/test/integration/targets/tower_inventory_source/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_job_cancel/aliases b/test/integration/targets/tower_job_cancel/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_job_cancel/aliases +++ b/test/integration/targets/tower_job_cancel/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_job_launch/aliases b/test/integration/targets/tower_job_launch/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_job_launch/aliases +++ b/test/integration/targets/tower_job_launch/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_job_list/aliases b/test/integration/targets/tower_job_list/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_job_list/aliases +++ b/test/integration/targets/tower_job_list/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_job_template/aliases b/test/integration/targets/tower_job_template/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_job_template/aliases +++ b/test/integration/targets/tower_job_template/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_job_wait/aliases b/test/integration/targets/tower_job_wait/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_job_wait/aliases +++ b/test/integration/targets/tower_job_wait/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_label/aliases b/test/integration/targets/tower_label/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_label/aliases +++ b/test/integration/targets/tower_label/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_notification/aliases b/test/integration/targets/tower_notification/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_notification/aliases +++ b/test/integration/targets/tower_notification/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_organization/aliases b/test/integration/targets/tower_organization/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_organization/aliases +++ b/test/integration/targets/tower_organization/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_organization/tasks/main.yml b/test/integration/targets/tower_organization/tasks/main.yml index 76fa99bbb17..bd28bf86162 100644 --- a/test/integration/targets/tower_organization/tasks/main.yml +++ b/test/integration/targets/tower_organization/tasks/main.yml @@ -11,3 +11,34 @@ - name: Make sure the default Default organization exists tower_organization: name: Default + +- name: Check that SSL is available + tower_organization: + name: Default + register: result + +- name: Check we haven't changed anything + assert: + that: result is not changed + +- name: Check that SSL is available and verify_ssl is enabled (task must fail) + tower_organization: + name: Default + environment: + TOWER_CERTIFICATE: /dev/null # force check failure + ignore_errors: true + register: check_ssl_is_used + +- name: Disable verify_ssl in ~/.tower_cli.cfg + copy: + dest: ~/.tower_cli.cfg + content: | + [general] + verify_ssl = False + force: false # ensure remote file doesn't exist + +- name: Check that verify_ssl is disabled (task must not fail) + tower_organization: + name: Default + environment: + TOWER_CERTIFICATE: /dev/null # should not fail because verify_ssl is disabled diff --git a/test/integration/targets/tower_project/aliases b/test/integration/targets/tower_project/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_project/aliases +++ b/test/integration/targets/tower_project/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_project/tasks/create_project_dir.yml b/test/integration/targets/tower_project/tasks/create_project_dir.yml index e0ad5d5c320..5238da8b453 100644 --- a/test/integration/targets/tower_project/tasks/create_project_dir.yml +++ b/test/integration/targets/tower_project/tasks/create_project_dir.yml @@ -5,6 +5,7 @@ password: "{{ tower_password }}" validate_certs: false return_content: true + force_basic_auth: true register: awx_config - tower_inventory: diff --git a/test/integration/targets/tower_receive/aliases b/test/integration/targets/tower_receive/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_receive/aliases +++ b/test/integration/targets/tower_receive/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_role/aliases b/test/integration/targets/tower_role/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_role/aliases +++ b/test/integration/targets/tower_role/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_role/tasks/main.yml b/test/integration/targets/tower_role/tasks/main.yml index 7088cc8059e..eb1602f9b60 100644 --- a/test/integration/targets/tower_role/tasks/main.yml +++ b/test/integration/targets/tower_role/tasks/main.yml @@ -27,14 +27,6 @@ that: - "result is changed" -- name: Test tower_verify_ssl alias - tower_role: - user: joe - role: update - project: Demo Project - tower_verify_ssl: true - state: absent - - name: Delete a User tower_user: username: joe diff --git a/test/integration/targets/tower_send/aliases b/test/integration/targets/tower_send/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_send/aliases +++ b/test/integration/targets/tower_send/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_settings/aliases b/test/integration/targets/tower_settings/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_settings/aliases +++ b/test/integration/targets/tower_settings/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_team/aliases b/test/integration/targets/tower_team/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_team/aliases +++ b/test/integration/targets/tower_team/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_user/aliases b/test/integration/targets/tower_user/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_user/aliases +++ b/test/integration/targets/tower_user/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_workflow_launch/aliases b/test/integration/targets/tower_workflow_launch/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_workflow_launch/aliases +++ b/test/integration/targets/tower_workflow_launch/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/integration/targets/tower_workflow_launch/tasks/main.yml b/test/integration/targets/tower_workflow_launch/tasks/main.yml index b6f183a8fdb..c4d791a9310 100644 --- a/test/integration/targets/tower_workflow_launch/tasks/main.yml +++ b/test/integration/targets/tower_workflow_launch/tasks/main.yml @@ -5,6 +5,7 @@ password: "{{ tower_password }}" user: "{{ tower_username }}" validate_certs: False + force_basic_auth: true register: unified_job - name: Build workflow @@ -20,6 +21,7 @@ status_code: 201 user: "{{ tower_username }}" validate_certs: False + force_basic_auth: true register: workflow - name: Add a node @@ -42,6 +44,7 @@ status_code: 201 user: "{{ tower_username }}" validate_certs: False + force_basic_auth: true register: node1 - name: Add a node @@ -64,6 +67,7 @@ status_code: 201 user: "{{ tower_username }}" validate_certs: False + force_basic_auth: true register: node2 - name: "Link nodes {{ node2.json.id }} to {{ node1.json.id }}" @@ -76,3 +80,4 @@ status_code: 204 user: "{{ tower_username }}" validate_certs: False + force_basic_auth: true diff --git a/test/integration/targets/tower_workflow_template/aliases b/test/integration/targets/tower_workflow_template/aliases index 350a0410424..229eebe6c9b 100644 --- a/test/integration/targets/tower_workflow_template/aliases +++ b/test/integration/targets/tower_workflow_template/aliases @@ -1,2 +1,2 @@ cloud/tower -unsupported +shippable/tower/group1 diff --git a/test/lib/ansible_test/_internal/cloud/tower.py b/test/lib/ansible_test/_internal/cloud/tower.py index f6093741ddf..04d7bcba4c5 100644 --- a/test/lib/ansible_test/_internal/cloud/tower.py +++ b/test/lib/ansible_test/_internal/cloud/tower.py @@ -75,6 +75,7 @@ class TowerCloudProvider(CloudProvider): '3.2.3': '3.3.0', '3.3.5': '3.3.3', '3.4.3': '3.3.3', + '3.6.2': '3.3.8', } cli_version = tower_cli_version_map.get(self.version, fallback) @@ -103,7 +104,7 @@ class TowerCloudProvider(CloudProvider): display.info('Provisioning %s cloud environment.' % self.platform, verbosity=1) # temporary solution to allow version selection - self.version = os.environ.get('TOWER_VERSION', '3.2.3') + self.version = os.environ.get('TOWER_VERSION', '3.6.2') self.check_tower_version(os.environ.get('TOWER_CLI_VERSION')) aci = get_tower_aci(self.args, self.version) @@ -148,6 +149,9 @@ class TowerCloudEnvironment(CloudEnvironment): run_command(self.args, cmd) + cmd = ['tower-cli', 'config', 'verify_ssl', 'false'] + run_command(self.args, cmd, capture=True) + def disable_pendo(self): """Disable Pendo tracking.""" display.info('Disable Pendo tracking')