Skip to content

Commit

Permalink
added tiny_prefix to isolate test runs
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-savina committed Jul 17, 2024
1 parent 2b87169 commit 46c823a
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 31 deletions.
5 changes: 4 additions & 1 deletion tests/integration/targets/runme.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env bash
source ../init.sh

# Generates a string starting with 'test-' followed by 4 random lowercase characters
TINY_PREFIX="test-$(uuidgen | tr -d '-' | cut -c1-4 | tr '[:upper:]' '[:lower:]')"

# Extract the ansible_tags from integration_config.yml
ANSIBLE_TAGS=$(awk '/ansible_tags/ {print $2}' ../../integration_config.yml)

# Check if the ANSIBLE_TAGS variable is set
if [[ -n "$ANSIBLE_TAGS" ]]; then
echo "ANSIBLE_TAGS is set to: $ANSIBLE_TAGS"
exec ansible-playbook run.yml --tags "$ANSIBLE_TAGS"
exec ansible-playbook run.yml --tags "$ANSIBLE_TAGS" --extra-vars "tiny_prefix=$TINY_PREFIX"
else
echo "ANSIBLE_TAGS is not set for Eco vCenter. Running on simulator."
exec ansible-playbook run.yml --tags integration-ci
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cluster_settings_username: "{{ vcenter_username }}"
cluster_settings_password: "{{ vcenter_password }}"
cluster_settings_validate_certs: false
cluster_settings_port: "{{ vcenter_port }}"
cluster_settings_cluster_name: "Test-Cluster"
cluster_settings_cluster_name: "{{ tiny_prefix }}-Test-Cluster"
cluster_settings_datacenter_name: "{{ vcenter_datacenter }}"

# DPM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ content_library_datacenter_name: "{{ vcenter_datacenter }}"

content_library_datastore_name: "datastore3"
content_library_type: local
content_library_name: eco-vcenter-ci-vmware-content-library-test
content_library_name: "{{ tiny_prefix }}-eco-vcenter-ci-vmware-content-library-test"
content_library_description: "Test content library"
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ deploy_ovf_power_on: true

vm_power_status: "{{ 'poweredOn' if deploy_ovf_power_on else 'poweredOff' }}"

test_vm_name: deploy-ovf-vm
test_vm_name: "{{ tiny_prefix }}-deploy-ovf-vm"
test_vm_hardware:
memory_mb: 2000
num_cpus: 2

ovf_library: deploy-ovf-test-library
ovf_library_item_name: deploy-ovf-test-template
ovf_library: "{{ tiny_prefix }}-deploy-ovf-test-library"
ovf_library_item_name: "{{ tiny_prefix }}-deploy-ovf-test-template"

vm_name_local_ovf: deploy-ovf-test-from-local-ovf
vm_name_local_ovf: "{{ tiny_prefix }}-deploy-ovf-test-from-local-ovf"
ovf_template_local: "{{ vmware_deploy_ovf_test_export_dir }}/{{ test_vm_name }}/{{ test_vm_name }}.ovf"

vm_name_content_library: deploy-ovf-test-from-content-library
vm_name_content_library: "{{ tiny_prefix }}-deploy-ovf-test-from-content-library"
ovf_template_content_library: "{{ ovf_library_item_name }}"
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
# General vars
run_on_simulator: false
resource_prefix: host-maintenance
resource_pool_name: "{{ resource_prefix }}-pool"

resource_pool_name: "{{ tiny_prefix }}-host-maintenance-pool"

# Vars for cloud.vmware_ops.provision_virtual_esxi role
provision_virtual_esxi_hostname: "{{ vcenter_hostname }}"
Expand All @@ -16,7 +16,7 @@ provision_virtual_esxi_folder: ""
provision_virtual_esxi_resource_pool: "{{ resource_pool_name }}"
provision_virtual_esxi_datastore_iso_path: "{{ custom_esxi_8_iso_path }}"
provision_virtual_esxi_vms:
- name: ci-vcenter-maintenance-test
- name: "{{ tiny_prefix }}-vm-esxi_maintenance-test"
provision_virtual_esxi_networks:
- name: "{{ test_network_name }}"
device_type: "vmxnet3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ export_vm_as_ovf_validate_certs: false
export_vm_as_ovf_datacenter_name: "{{ vcenter_datacenter }}"

export_vm_as_ovf_export_dir: /tmp/export_vm_as_ovf
export_vm_as_ovf_vm_name: export-vm-as-ovf-test
export_vm_as_ovf_vm_name: "{{ tiny_prefix }}-export-vm-as-ovf-test"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name: cloud.vmware_ops.manage_folder
vars:
manage_folder_state: present
manage_folder_folder_name: production/foo/web
manage_folder_folder_name: "{{ folder_name_pattern }}/foo/web"
manage_folder_folder_type: "{{ item }}"

- name: Create Folder Without Managing Full Tree
Expand All @@ -22,7 +22,7 @@
vars:
manage_folder_state: present
manage_folder_folder_name: db
manage_folder_parent_folder: production/foo
manage_folder_parent_folder: "{{ folder_name_pattern }}/foo"
manage_folder_folder_type: "{{ item }}"

- name: Create A Folder With A Slash In It
Expand All @@ -32,7 +32,7 @@
vars:
manage_folder_state: present
manage_folder_folder_name: security/syseng
manage_folder_parent_folder: production/foo
manage_folder_parent_folder: "{{ folder_name_pattern }}/foo"
manage_folder_parse_name_as_path: false
manage_folder_folder_type: "{{ item }}"

Expand All @@ -50,9 +50,9 @@
- name: Check Folders Were Created
ansible.builtin.assert:
that:
- _folder_info.folder_info.hostFolders.subfolders.production.subfolders.foo.subfolders['web'] is defined
- _folder_info.folder_info.hostFolders.subfolders.production.subfolders.foo.subfolders['db'] is defined
- _folder_info.folder_info.hostFolders.subfolders.production.subfolders.foo.subfolders['security%2fsyseng'] is defined
- _folder_info.folder_info.hostFolders.subfolders[folder_name_pattern].subfolders.foo.subfolders['web'] is defined
- _folder_info.folder_info.hostFolders.subfolders[folder_name_pattern].subfolders.foo.subfolders['db'] is defined
- _folder_info.folder_info.hostFolders.subfolders[folder_name_pattern].subfolders.foo.subfolders['security%2fsyseng'] is defined
fail_msg: Folder structure does not match expected result.

always:
Expand All @@ -66,5 +66,5 @@
name: cloud.vmware_ops.manage_folder
vars:
manage_folder_state: absent
manage_folder_folder_name: production
manage_folder_folder_name: "{{ folder_name_pattern }}"
manage_folder_folder_type: "{{ item }}"
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
run_on_simulator: true
folder_name_pattern: "production"

manage_folder_hostname: "127.0.0.1"
manage_folder_username: "test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
run_on_simulator: false
folder_name_pattern: "{{ tiny_prefix }}_production"

manage_folder_hostname: "{{ vcenter_hostname }}"
manage_folder_username: "{{ vcenter_username }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#!/usr/bin/env bash
source ../init.sh

# Generates a string starting with 'test-' followed by 4 random lowercase characters
TINY_PREFIX="test-$(uuidgen | tr -d '-' | cut -c1-4 | tr '[:upper:]' '[:lower:]')"

# Extract the ansible_tags from integration_config.yml
ANSIBLE_TAGS=$(awk '/ansible_tags/ {print $2}' ../../integration_config.yml)

# Check if the ANSIBLE_TAGS variable is set
if [[ -n "$ANSIBLE_TAGS" ]]; then
echo "ANSIBLE_TAGS is set to: $ANSIBLE_TAGS"
ansible-playbook run.yml --tags "$ANSIBLE_TAGS"
ansible-playbook run.yml --tags "$ANSIBLE_TAGS" --extra-vars "tiny_prefix=$TINY_PREFIX"
else
echo "ANSIBLE_TAGS is not set for Eco vCenter. Running on simulator."
ansible-playbook mock_side_effects.yml & ansible-playbook run.yml --tags integration-ci
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ provision_virtual_esxi_cluster: "{{ vcenter_cluster_name }}"
provision_virtual_esxi_folder: "e2e-qe"
provision_virtual_esxi_datacenter: "{{ vcenter_datacenter }}"
provision_virtual_esxi_datastore_iso_path: "{{ custom_esxi_8_iso_path }}"
resource_pool_name: ci-resource-pool-test
resource_pool_name: "{{ tiny_prefix }}-ci-resource-pool-test"
provision_virtual_esxi_vms:
- name: ci-esxi-test-1
- name: "{{ tiny_prefix }}-ci-esxi-test-1"
provision_virtual_esxi_networks:
- name: "{{ vm_network_name }}"
device_type: "vmxnet3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ provision_vm_datacenter: "{{ vcenter_datacenter }}"

# Create VM template
provision_vms_template:
- provision_vm_name: "qe-provision-vm-rhel-9"
- provision_vm_name: "{{ tiny_prefix }}-qe-provision-vm-rhel-9"
provision_vm_state: "poweredoff"
provision_vm_cdrom:
- controller_number: 0
Expand All @@ -39,14 +39,14 @@ provision_vms_template:

# Provision VMs from template
provision_vms_from_template:
- provision_vm_name: "qe-provision-vm-from-template"
- provision_vm_name: "{{ tiny_prefix }}-qe-provision-vm-from-template"
provision_vm_state: "poweredon"
provision_vm_template: "{{ provision_vms_template[0].provision_vm_name }}"
provision_vm_datastore: "datastore1"

provision_vms:
# RHEL9 VM
- provision_vm_name: "qe-provision-vm-rhel-9"
- provision_vm_name: "{{ tiny_prefix }}-qe-provision-vm-rhel-9"
provision_vm_state: "poweredoff"
provision_vm_cdrom:
- controller_number: 0
Expand All @@ -71,7 +71,7 @@ provision_vms:
provision_vm_guest_id: "rhel9_64Guest"
provision_vm_datastore: "datastore1"
# RHEL8 VM
- provision_vm_name: "qe-provision-vm-rhel-8"
- provision_vm_name: "{{ tiny_prefix }}-qe-provision-vm-rhel-8"
provision_vm_state: "poweredon"
provision_vm_cdrom:
- controller_number: 0
Expand Down Expand Up @@ -101,7 +101,7 @@ vm_update_name: "{{ vm_to_update.provision_vm_name }}"
vm_update_datastore: "{{ vm_to_update.provision_vm_datastore }}"

vm_names_to_update:
- vm_updated_name
- "{{ tiny_prefix }}_vm_updated_name"
- "{{ vm_update_name }}"

vm_states:
Expand All @@ -120,7 +120,7 @@ vm_updated_hardware:
secure_boot: true

vswitch_name: vSwitch0
portgroup_name: qe-network
portgroup_name: "{{ tiny_prefix }}-qe-network"

vm_network_to_add:
- name: "{{ portgroup_name }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ vm_snapshots:
snapshot_management_state: present
snapshot_management_description: "This is the second snapshot of VM {{ manage_snapshot_vm_name }}"

manage_snapshot_vm_name: "manage-snapshot-vm-rhel-9"
manage_snapshot_vm_name: "{{ tiny_prefix }}-manage-snapshot-vm-rhel-9"

vm_snapshots_updated:
- snapshot_management_snapshot_name: "{{ manage_snapshot_vm_name }}-snapshot-1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# General
run_on_simulator: false
resource_pool_name: "host-connection-test-pool"
resource_pool_name: "{{ tiny_prefix }}-host-connection-test-pool"

# Vars for cloud.vmware_ops.provision_virtual_esxi role
provision_virtual_esxi_hostname: "{{ vcenter_hostname }}"
Expand All @@ -15,7 +15,7 @@ provision_virtual_esxi_folder: ""
provision_virtual_esxi_resource_pool: "{{ resource_pool_name }}"
provision_virtual_esxi_datastore_iso_path: "{{ custom_esxi_8_iso_path }}"
provision_virtual_esxi_vms:
- name: "vm-host-connection-test"
- name: "{{ tiny_prefix }}-vm-host-connection-test"
provision_virtual_esxi_networks:
- name: "{{ test_network_name }}"
device_type: "vmxnet3"
Expand Down

0 comments on commit 46c823a

Please sign in to comment.