From c93fe265ca84ea9704d63e31fd83bef711516f53 Mon Sep 17 00:00:00 2001 From: Anna Savina <87815814+anna-savina@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:48:55 +0200 Subject: [PATCH] adapt tests to run with AAP (#559) Modified authorization variables in order to run tests with AAP Reviewed-by: Polina Rabinovich Reviewed-by: Shelly Miron --- tests/integration/integration_config.yml.tpl | 8 ++++---- tests/integration/targets/init-eco.sh | 8 ++++---- .../tasks/appliance_networking_dns_hostname.yml | 2 +- .../targets/vmware_rest_lookup_plugin/playbook.yml | 5 ----- .../targets/vmware_rest_lookup_plugin/tasks/main.yml | 5 +++++ .../vmware_rest_vcenter_vm_clone_on_library/playbook.yml | 5 ----- .../tasks/main.yml | 5 +++++ .../targets/vmware_rest_vcenter_vm_cloning/playbook.yml | 6 ------ .../targets/vmware_rest_vcenter_vm_cloning/tasks/main.yml | 5 +++++ 9 files changed, 24 insertions(+), 25 deletions(-) diff --git a/tests/integration/integration_config.yml.tpl b/tests/integration/integration_config.yml.tpl index 27b03476..6ec72083 100644 --- a/tests/integration/integration_config.yml.tpl +++ b/tests/integration/integration_config.yml.tpl @@ -1,6 +1,6 @@ --- -VMWARE_HOST: ${VCENTER_HOSTNAME} -VMWARE_USER: ${VCENTER_USERNAME} -VMWARE_PASSWORD: ${VCENTER_PASSWORD} -VMWARE_VALIDATE_CERTS: false +vcenter_hostname: ${VCENTER_HOSTNAME} +vcenter_username: ${VCENTER_USERNAME} +vcenter_password: ${VCENTER_PASSWORD} +vcenter_validate_certs: false ansible_tags: eco-vcenter-ci diff --git a/tests/integration/targets/init-eco.sh b/tests/integration/targets/init-eco.sh index b63b96ac..3b96be79 100644 --- a/tests/integration/targets/init-eco.sh +++ b/tests/integration/targets/init-eco.sh @@ -14,7 +14,7 @@ BASE_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")") export ANSIBLE_ROLES_PATH=${BASE_DIR} # Authentication vars -export VMWARE_HOST=$(awk '/VMWARE_HOST/ {print $2}' ../../integration_config.yml) -export VMWARE_USER=$(awk '/VMWARE_USER/ {print $2}' ../../integration_config.yml) -export VMWARE_PASSWORD=$(awk '/VMWARE_PASSWORD/ {print $2}' ../../integration_config.yml) -export VMWARE_VALIDATE_CERTS=$(awk '/VMWARE_VALIDATE_CERTS/ {print $2}' ../../integration_config.yml) \ No newline at end of file +export VMWARE_HOST=$(awk '/vcenter_hostname/ {print $2}' ../../integration_config.yml) +export VMWARE_USER=$(awk '/vcenter_username/ {print $2}' ../../integration_config.yml) +export VMWARE_PASSWORD=$(awk '/vcenter_password/ {print $2}' ../../integration_config.yml) +export VMWARE_VALIDATE_CERTS=$(awk '/vcenter_validate_certs/ {print $2}' ../../integration_config.yml) \ No newline at end of file diff --git a/tests/integration/targets/vmware_rest_appliance/tasks/appliance_networking_dns_hostname.yml b/tests/integration/targets/vmware_rest_appliance/tasks/appliance_networking_dns_hostname.yml index d137fa65..a93da99a 100644 --- a/tests/integration/targets/vmware_rest_appliance/tasks/appliance_networking_dns_hostname.yml +++ b/tests/integration/targets/vmware_rest_appliance/tasks/appliance_networking_dns_hostname.yml @@ -17,7 +17,7 @@ - name: Test the hostname configuration vmware.vmware_rest.appliance_networking_dns_hostname: state: test - name: "{{ VMWARE_HOST }}" + name: "{{ vcenter_hostname }}" register: test_hostname_result - name: Assert hostname test result is successful diff --git a/tests/integration/targets/vmware_rest_lookup_plugin/playbook.yml b/tests/integration/targets/vmware_rest_lookup_plugin/playbook.yml index a112bc8e..4ccb2030 100644 --- a/tests/integration/targets/vmware_rest_lookup_plugin/playbook.yml +++ b/tests/integration/targets/vmware_rest_lookup_plugin/playbook.yml @@ -2,11 +2,6 @@ gather_facts: no tasks: - - name: Import eco-vcenter credentials - ansible.builtin.include_vars: - file: ../group_vars.yml - tags: eco-vcenter-ci - - name: Import vmware_rest_lookup_plugin test ansible.builtin.import_role: name: vmware_rest_lookup_plugin diff --git a/tests/integration/targets/vmware_rest_lookup_plugin/tasks/main.yml b/tests/integration/targets/vmware_rest_lookup_plugin/tasks/main.yml index 42058904..f1dff373 100644 --- a/tests/integration/targets/vmware_rest_lookup_plugin/tasks/main.yml +++ b/tests/integration/targets/vmware_rest_lookup_plugin/tasks/main.yml @@ -1,6 +1,11 @@ --- - name: Test lookup plugin block: + - name: Import eco-vcenter common vars + ansible.builtin.include_vars: + file: ../group_vars.yml + tags: eco-vcenter-ci + - name: Create test cluster vmware.vmware.cluster: datacenter: "{{ vcenter_datacenter }}" diff --git a/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/playbook.yml b/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/playbook.yml index f8e3f620..76367c0d 100644 --- a/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/playbook.yml +++ b/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/playbook.yml @@ -2,11 +2,6 @@ gather_facts: no tasks: - - name: Import eco-vcenter credentials - ansible.builtin.include_vars: - file: ../group_vars.yml - tags: eco-vcenter-ci - - name: Import vmware_rest_lookup_plugin test ansible.builtin.import_role: name: vmware_rest_vcenter_vm_clone_on_library diff --git a/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/tasks/main.yml b/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/tasks/main.yml index e9840488..ea929497 100644 --- a/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/tasks/main.yml +++ b/tests/integration/targets/vmware_rest_vcenter_vm_clone_on_library/tasks/main.yml @@ -1,6 +1,11 @@ --- - name: Test VM clone on library block: + - name: Import eco-vcenter common vars + ansible.builtin.include_vars: + file: ../group_vars.yml + tags: eco-vcenter-ci + - name: Create a content library based on a DataStore vmware.vmware_rest.content_locallibrary: name: "{{ library_name }}" diff --git a/tests/integration/targets/vmware_rest_vcenter_vm_cloning/playbook.yml b/tests/integration/targets/vmware_rest_vcenter_vm_cloning/playbook.yml index 566631a5..19177932 100644 --- a/tests/integration/targets/vmware_rest_vcenter_vm_cloning/playbook.yml +++ b/tests/integration/targets/vmware_rest_vcenter_vm_cloning/playbook.yml @@ -2,12 +2,6 @@ gather_facts: no tasks: - - name: Import common vars - ansible.builtin.include_vars: - file: ../group_vars.yml - tags: - - eco-vcenter-ci - - name: Import appliance role ansible.builtin.import_role: name: vmware_rest_vcenter_vm_cloning diff --git a/tests/integration/targets/vmware_rest_vcenter_vm_cloning/tasks/main.yml b/tests/integration/targets/vmware_rest_vcenter_vm_cloning/tasks/main.yml index 992897d0..15c4a03f 100644 --- a/tests/integration/targets/vmware_rest_vcenter_vm_cloning/tasks/main.yml +++ b/tests/integration/targets/vmware_rest_vcenter_vm_cloning/tasks/main.yml @@ -1,6 +1,11 @@ --- - name: Test VM cloning on a real vCenter block: + - name: Import eco-vcenter common vars + ansible.builtin.include_vars: + file: ../group_vars.yml + tags: eco-vcenter-ci + - name: Create a generic resource pool vmware.vmware_rest.vcenter_resourcepool: name: "{{ resource_pool_name }}"