From ad8a14b0c87f7c250bc947dde779404403be7073 Mon Sep 17 00:00:00 2001 From: Alaa Bishtawi Date: Tue, 7 Nov 2023 10:12:24 +0200 Subject: [PATCH 1/5] Add Contributaiong --- CONTRIBUTING.md | 38 ++++++ .../targets/prepare_env/vars/main.yml | 120 ++++++++++++++++++ 2 files changed, 158 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b2822bfb5..a2a585629 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -115,3 +115,41 @@ 6. Link the pull request in `issue#` 7. After the pull request is merged, close the `issue#` + + +## Testing + +# Integration Testing for Ansible Modules + +To perform integration tests for any specific Ansible module such as the `ntnx_vms` module, follow these step-by-step procedures: + +## Prerequisites +- Ensure you are in the collection directory where the module is located. + +## Setting up Variables +1. Navigate to the `tests/integration/targets` directory within the collection. +2. Fill in the necessary variables inside `prepare_env/vars/main.yml`. +3. Run the 'prepare_env' playbook by executing the command: + ```bash + ansible-playbook prepare_env/tasks/prepare_env.yml + ``` + +## Running Integration Tests +4. Run the integration tests for all modules using: + ```bash + ansible-integration + ``` + +5. To perform an integration test for a specific module, use: + ```bash + ansible-integration module_test_name + ``` + Replace `module_test_name` with the actual module's name. + +## Cleanup +6. After completing all integration tests, clean up the environment by running: + ```bash + ansible-playbook prepare_env/tasks/cleanup.yml + ``` + +By following these steps, you can conduct comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. diff --git a/tests/integration/targets/prepare_env/vars/main.yml b/tests/integration/targets/prepare_env/vars/main.yml index e69de29bb..f9f30952f 100644 --- a/tests/integration/targets/prepare_env/vars/main.yml +++ b/tests/integration/targets/prepare_env/vars/main.yml @@ -0,0 +1,120 @@ +ip: EXAMPLE_IP +username: EXAMPLE_USERNAME +password: EXAMPLE_PASSWORD +validate_certs: false +cluster: + name: EXAMPLE_CLUSTER_NAME + uuid: EXAMPLE_CLUSTER_UUID +k8s_version: EXAMPLE_K8S_VERSION +host_os: EXAMPLE_HOST_OS +network: + dhcp: + name: EXAMPLE_VLAN_NAME + uuid: EXAMPLE_VLAN_UUID + static: + ip: EXAMPLE_STATIC_IP +nutanix_cluster_password: EXAMPLE_CLUSTER_PASSWORD +nutanix_cluster_username: EXAMPLE_CLUSTER_USERNAME + +cni: + node_cidr_mask_size: "EXAMPLE_MASK_CIDR" + service_ipv4_cidr: "EXAMPLE_SERVICE_CIDR" + pod_ipv4_cidr: "EXAMPLE_POD_CIDR" +vm_owner: + name: EXAMPLE_OWNER_NAME + uuid: EXAMPLE_OWNER_UUID + +todelete: [] + +disk_image: + url: EXAMPLE_IMAGE_URL + dest: EXAMPLE_DEST_PATH + checksum: EXAMPLE_CHECKSUM + centos: "EXAMPLE_CENTOS" + +external_nat_subnets: + name: EXAMPLE_NAT_NAME + vlan_id: EXAMPLE_VLAN_ID + gateway_ip_address: EXAMPLE_GATEWAY_IP + network_prefix: EXAMPLE_PREFIX + network_ip: EXAMPLE_NETWORK_IP + dhcp: + start_address: EXAMPLE_START_DHCP + end_address: EXAMPLE_END_DHCP + static: + start_address: EXAMPLE_START_STATIC + end_address: EXAMPLE_END_STATIC + +vpc_name: EXAMPLE_VPC_NAME +vm_name: EXAMPLE_VM_NAME +static_subnet_name: EXAMPLE_STATIC_SUBNET +overlay_subnet: + name: EXAMPLE_OVERLAY_NAME + network_ip: EXAMPLE_OVERLAY_NETWORK_IP + network_prefix: EXAMPLE_OVERLAY_PREFIX + gateway_ip: EXAMPLE_OVERLAY_GATEWAY_IP + private_ip: EXAMPLE_OVERLAY_PRIVATE_IP + +quarantine_rule_uuid: EXAMPLE_QUARANTINE_UUID +categories: + apptiers: + - Default + - sub_app_1 +centos: "EXAMPLE_CENTOS" +ubuntu: "EXAMPLE_UBUNTU" + +virtual_switch: + name: EXAMPLE_SWITCH_NAME + uuid: EXAMPLE_SWITCH_UUID + +storage_container: + name: EXAMPLE_CONTAINER_NAME + uuid: EXAMPLE_CONTAINER_UUID + +users: + - EXAMPLE_USER_UUID_1 + - EXAMPLE_USER_UUID_2 +user_groups: + - EXAMPLE_GROUP_UUID + +project: + name: EXAMPLE_PROJECT_NAME + uuid: EXAMPLE_PROJECT_UUID + +roles: + - "EXAMPLE_ROLES_NAME_1" + - "EXAMPLE_ROLES_NAME_2" + - "EXAMPLE_ROLES_NAME_3" + - "EXAMPLE_ROLES_NAME_4" + +accounts: + - name: "NTNX_LOCAL_AZ" + uuid: "EXAMPLE_ACCOUNT_UUID" + +new_user: "EXAMPLE_NEW_USER_EMAIL" + +new_user_group: "EXAMPLE_NEW_USER_GROUP_DN" + +acp: + role: + name: "Project Admin" + uuid: EXAMPLE_ROLE_UUID + user_uuid: EXAMPLE_USER_UUID + user_group_uuid: EXAMPLE_GROUP_UUID + +distinguished_name: "EXAMPLE_DISTINGUISHED_NAME" +principal_name: "EXAMPLE_PRINCIPAL_NAME" +directory_service_uuid: "EXAMPLE_DIRECTORY_UUID" +identity_provider_uuid: "EXAMPLE_IDENTITY_UUID" + +dr_vm_name: EXAMPLE_VM_NAME +dr: + primary_az_url: EXAMPLE_PRIMARY_URL + recovery_az_url: EXAMPLE_RECOVERY_URL + recovery_site_network: "EXAMPLE_RECOVERY_NETWORK" + recovery_ip1: EXAMPLE_RECOVERY_IP1 + recovery_ip2: EXAMPLE_RECOVERY_IP2 + gateway_ip: EXAMPLE_GATEWAY_IP + prefix: EXAMPLE_PREFIX + +url: EXAMPLE_URL From 33615fa40e3cc6aa9c57383c456579474a5199e3 Mon Sep 17 00:00:00 2001 From: Alaa Bishtawi Date: Tue, 7 Nov 2023 10:57:05 +0200 Subject: [PATCH 2/5] enhance contributaion --- CONTRIBUTING.md | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a2a585629..bc089911e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,11 +128,21 @@ To perform integration tests for any specific Ansible module such as the `ntnx_v ## Setting up Variables 1. Navigate to the `tests/integration/targets` directory within the collection. -2. Fill in the necessary variables inside `prepare_env/vars/main.yml`. -3. Run the 'prepare_env' playbook by executing the command: - ```bash - ansible-playbook prepare_env/tasks/prepare_env.yml - ``` +2. Fill in the necessary variables inside different feature-specific var files, such as `prepare_nv_env/vars/main.yml`, `prepare_ndb_env/vars/main.yml`, `prepare_foundation_env/vars/main.yml`, etc. Note: Not all variables are compulsory; define only the required variables for the specific feature you want to test. +3. Run the playbook for the specific feature you intend to test: + - For PC tests, execute the command: + ```bash + ansible-playbook prepare_env/tasks/prepare_env.yml + ``` + - For NDB tests, execute the command: + ```bash + ansible-playbook prepare_ndb_env/tasks/prepare_env.yml + ``` + - For Foundation tests, execute the command: + ```bash + ansible-playbook prepare_foundation_env/tasks/prepare_foundation_env.yml + ``` + - Replace 'feature' with the specific feature you intend to test. ## Running Integration Tests 4. Run the integration tests for all modules using: @@ -147,9 +157,15 @@ To perform integration tests for any specific Ansible module such as the `ntnx_v Replace `module_test_name` with the actual module's name. ## Cleanup -6. After completing all integration tests, clean up the environment by running: - ```bash - ansible-playbook prepare_env/tasks/cleanup.yml - ``` +6. After completing all integration tests, perform a cleanup specific to the tested feature: + - For PC tests, execute the command: + ```bash + ansible-playbook prepare_env/tasks/clean_up.yml + ``` + - For Foundation tests, execute the command: + ```bash + ansible-playbook prepare_foundation_env/tasks/clean_up.yml + ``` + +By following these steps, you can conduct comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. Define only the necessary variables for the specific feature you intend to test. -By following these steps, you can conduct comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. From 79a95447a7911f1d69cf5eb503241628e77eeb4b Mon Sep 17 00:00:00 2001 From: Alaa Bishtawi Date: Tue, 7 Nov 2023 11:13:57 +0200 Subject: [PATCH 3/5] fix readme --- CONTRIBUTING.md | 54 ------ README.md | 45 +++++ .../prepare_foundation_env/vars/main.yml | 79 +++++++++ .../targets/prepare_ndb_env/vars/main.yml | 167 ++++++++++++++++++ 4 files changed, 291 insertions(+), 54 deletions(-) create mode 100644 tests/integration/targets/prepare_foundation_env/vars/main.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bc089911e..b2822bfb5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -115,57 +115,3 @@ 6. Link the pull request in `issue#` 7. After the pull request is merged, close the `issue#` - - -## Testing - -# Integration Testing for Ansible Modules - -To perform integration tests for any specific Ansible module such as the `ntnx_vms` module, follow these step-by-step procedures: - -## Prerequisites -- Ensure you are in the collection directory where the module is located. - -## Setting up Variables -1. Navigate to the `tests/integration/targets` directory within the collection. -2. Fill in the necessary variables inside different feature-specific var files, such as `prepare_nv_env/vars/main.yml`, `prepare_ndb_env/vars/main.yml`, `prepare_foundation_env/vars/main.yml`, etc. Note: Not all variables are compulsory; define only the required variables for the specific feature you want to test. -3. Run the playbook for the specific feature you intend to test: - - For PC tests, execute the command: - ```bash - ansible-playbook prepare_env/tasks/prepare_env.yml - ``` - - For NDB tests, execute the command: - ```bash - ansible-playbook prepare_ndb_env/tasks/prepare_env.yml - ``` - - For Foundation tests, execute the command: - ```bash - ansible-playbook prepare_foundation_env/tasks/prepare_foundation_env.yml - ``` - - Replace 'feature' with the specific feature you intend to test. - -## Running Integration Tests -4. Run the integration tests for all modules using: - ```bash - ansible-integration - ``` - -5. To perform an integration test for a specific module, use: - ```bash - ansible-integration module_test_name - ``` - Replace `module_test_name` with the actual module's name. - -## Cleanup -6. After completing all integration tests, perform a cleanup specific to the tested feature: - - For PC tests, execute the command: - ```bash - ansible-playbook prepare_env/tasks/clean_up.yml - ``` - - For Foundation tests, execute the command: - ```bash - ansible-playbook prepare_foundation_env/tasks/clean_up.yml - ``` - -By following these steps, you can conduct comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. Define only the necessary variables for the specific feature you intend to test. - diff --git a/README.md b/README.md index 3e59c706a..6db825fa9 100644 --- a/README.md +++ b/README.md @@ -139,6 +139,51 @@ To run this playbook, use ansible-playbook command ansible-playbook ansible-playbook examples/iaas/iaas.yml ``` +# Testing + +## Integration Testing for Ansible Modules + +To conduct integration tests for a specific Ansible module such as the `ntnx_vms` module, the following step-by-step procedures can be followed: + +### Prerequisites +- Ensure you are in the collection directory where the module is located. + +### Setting up Variables +1. Navigate to the `tests/integration/targets` directory within the collection. +2. Define the necessary variables within the feature-specific var files, such as `prepare_env/vars/main.yml`, `prepare_foundation_env/vars/main.yml`,`prepare_ndb_env/tasks/prepare_env.yml`, etc. Note: For Karbon and FC tests, use the PC vars exclusively, as these features rely on this setup. Not all variables are mandatory; define only the required variables for the particular feature to be tested. +3. Run the playbook for the specific feature you intend to test: + - For PC, NDB, and Foundation tests, execute the relevant commands: + ```bash + ansible-playbook prepare_env/tasks/prepare_env.yml + ansible-playbook prepare_ndb_env/tasks/prepare_env.yml + ansible-playbook prepare_foundation_env/tasks/prepare_foundation_env.yml + ``` + Replace 'feature' with the specific feature you aim to test. + +### Running Integration Tests +4. Conduct integration tests for all modules using: + ```bash + ansible-integration + ``` + +5. To perform integration tests for a specific module: + ```bash + ansible-integration module_test_name + ``` + Replace `module_test_name` with the actual module's name. + +### Cleanup +6. After completing the integration tests, perform a cleanup specific to the tested feature: + - For PC tests, execute the command: + ```bash + ansible-playbook prepare_env/tasks/clean_up.yml + ``` + - For Foundation tests, execute the command: + ```bash + ansible-playbook prepare_foundation_env/tasks/clean_up.yml + ``` + +By following these steps, you can perform comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. Define only the necessary variables for the specific feature you intend to test, using PC vars for Karbon and FC tests. # Included Content diff --git a/tests/integration/targets/prepare_foundation_env/vars/main.yml b/tests/integration/targets/prepare_foundation_env/vars/main.yml new file mode 100644 index 000000000..5ecaf3000 --- /dev/null +++ b/tests/integration/targets/prepare_foundation_env/vars/main.yml @@ -0,0 +1,79 @@ +foundation_host: "EXAMPLE_FOUNDATION_HOST" +cvm_gateway: "EXAMPLE_CVM_GATEWAY" +cvm_netmask: "EXAMPLE_CVM_NETMASK" +hypervisor_gateway: "EXAMPLE_HYPERVISOR_GATEWAY" +hypervisor_netmask: "EXAMPLE_HYPERVISOR_NETMASK" +source: 'EXAMPLE_SOURCE_PATH' +image_url: "EXAMPLE_IMAGE_URL" +nos_package: "EXAMPLE_NOS_PACKAGE" +default_ipmi_user: "EXAMPLE_IPMI_USER" +IBIS_node: + block_id: "EXAMPLE_BLOCK_ID" + node1: + node_serial: "EXAMPLE_NODE_SERIAL_1" + hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_1" + cvm_ip: EXAMPLE_CVM_IP_1 + hypervisor_ip: EXAMPLE_HYPERVISOR_IP_1 + node_position: "EXAMPLE_NODE_POSITION_1" + hypervisor: "EXAMPLE_HYPERVISOR_1" + ipmi_password: "EXAMPLE_IPMI_PASSWORD_1" + ipmi_ip: EXAMPLE_IPMI_IP_1 + ipmi_netmask: "EXAMPLE_IPMI_NETMASK_1" + ipmi_gateway: EXAMPLE_IPMI_GATEWAY_1 + node2: + node_serial: "EXAMPLE_NODE_SERIAL_2" + hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_2" + cvm_ip: EXAMPLE_CVM_IP_2 + hypervisor_ip: EXAMPLE_HYPERVISOR_IP_2 + node_position: "EXAMPLE_NODE_POSITION_2" + hypervisor: "EXAMPLE_HYPERVISOR_2" + ipmi_password: "EXAMPLE_IPMI_PASSWORD_2" + ipmi_ip: EXAMPLE_IPMI_IP_2 + node3: + node_serial: "EXAMPLE_NODE_SERIAL_3" + hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_3" + cvm_ip: EXAMPLE_CVM_IP_3 + hypervisor_ip: EXAMPLE_HYPERVISOR_IP_3 + node_position: "EXAMPLE_NODE_POSITION_3" + hypervisor: "EXAMPLE_HYPERVISOR_3" + ipmi_password: "EXAMPLE_IPMI_PASSWORD_3" + ipmi_ip: EXAMPLE_IPMI_IP_3 + node4: + node_serial: "EXAMPLE_NODE_SERIAL_4" + hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_4" + cvm_ip: EXAMPLE_CVM_IP_4 + hypervisor_ip: EXAMPLE_HYPERVISOR_IP_4 + node_position: "EXAMPLE_NODE_POSITION_4" + hypervisor: "EXAMPLE_HYPERVISOR_4" + ipmi_password: "EXAMPLE_IPMI_PASSWORD_4" + ipmi_ip: EXAMPLE_IPMI_IP_4 +nodes: + current_cvm_vlan_tag: "EXAMPLE_CVM_VLAN_TAG" + block_id: "EXAMPLE_BLOCK_ID_NODES" + node1: + cvm_ip: EXAMPLE_CVM_IP_NODE1 + hypervisor: "EXAMPLE_HYPERVISOR_NODE1" + hypervisor_ip: EXAMPLE_HYPERVISOR_IP_NODE1 + node_position: "EXAMPLE_NODE_POSITION_NODE1" + hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_NODE1" + node_serial: "EXAMPLE_NODE_SERIAL_NODE1" + ipmi_password: "EXAMPLE_IPMI_PASSWORD_NODE1" + ipmi_ip: EXAMPLE_IPMI_IP_NODE1 + ipmi_netmask: "EXAMPLE_IPMI_NETMASK_NODE1" + ipmi_gateway: EXAMPLE_IPMI_GATEWAY_NODE1 + ntp_servers: + - "EXAMPLE_NTP_SERVER_1" + - "EXAMPLE_NTP_SERVER_2" + dns_servers: + - "EXAMPLE_DNS_SERVER_1" + - "EXAMPLE_DNS_SERVER_2" + backplane_vlan: "EXAMPLE_BACKPLANE_VLAN" + backplane_subnet: "EXAMPLE_BACKPLANE_SUBNET" + backplane_netmask: "EXAMPLE_BACKPLANE_NETMASK" +bmc: + ipmi_user: "EXAMPLE_IPMI_USER_BMC" + ipmi_password: "EXAMPLE_IPMI_PASSWORD_BMC" + ipmi_netmask: "EXAMPLE_IPMI_NETMASK_BMC" + ipmi_gateway: EXAMPLE_IPMI_GATEWAY_BMC + ipmi_mac: "EXAMPLE_IPMI_MAC" + ipmi_ip: EXAMPLE_IPMI_IP_BMC diff --git a/tests/integration/targets/prepare_ndb_env/vars/main.yml b/tests/integration/targets/prepare_ndb_env/vars/main.yml index e69de29bb..5fdce068e 100644 --- a/tests/integration/targets/prepare_ndb_env/vars/main.yml +++ b/tests/integration/targets/prepare_ndb_env/vars/main.yml @@ -0,0 +1,167 @@ +network_profile: + name: "EXAMPLE_NETWORK_PROFILE_NAME" + uuid: "EXAMPLE_NETWORK_PROFILE_UUID" + single: + cluster: + name: "EXAMPLE_CLUSTER_NAME" + vlan_name: "EXAMPLE_VLAN_NAME" + HA: + cluster1: + name: "EXAMPLE_CLUSTER1_NAME" + vlan_name: "EXAMPLE_VLAN_NAME" + vlan_name2: "EXAMPLE_VLAN_NAME" + cluster2: + name: "EXAMPLE_CLUSTER2_NAME" + vlan_name: "EXAMPLE_VLAN_NAME" + vlan_name2: "EXAMPLE_VLAN_NAME" + +software_profile: + name: "EXAMPLE_SOFTWARE_PROFILE_NAME" + uuid: "EXAMPLE_SOFTWARE_PROFILE_UUID" + latest_version_id: "EXAMPLE_LATEST_VERSION_ID" + +compute_profile: + name: "EXAMPLE_COMPUTE_PROFILE_NAME" + uuid: "EXAMPLE_COMPUTE_PROFILE_UUID" + +db_params_profile: + name: "EXAMPLE_DB_PARAMS_PROFILE_NAME" + uuid: "EXAMPLE_DB_PARAMS_PROFILE_UUID" + +static_network_profile: + name: "EXAMPLE_STATIC_NETWORK_PROFILE_NAME" + uuid: "EXAMPLE_STATIC_NETWORK_PROFILE_UUID" + +postgres_ha_profiles: + static_network_profile: + name: "EXAMPLE_STATIC_HA_STATIC_NAME" + uuid: "EXAMPLE_STATIC_HA_STATIC_UUID" + + multicluster_network_profile: + name: "EXAMPLE_HA_MULTICLUSTER_NAME" + uuid: "EXAMPLE_HA_MULTICLUSTER_UUID" + + software_profile: + name: "EXAMPLE_POSTGRES_SOFTWARE_PROFILE_NAME" + uuid: "EXAMPLE_POSTGRES_SOFTWARE_PROFILE_UUID" + latest_version_id: "EXAMPLE_LATEST_VERSION_ID" + + compute_profile: + name: "EXAMPLE_COMPUTE_PROFILE_NAME" + uuid: "EXAMPLE_COMPUTE_PROFILE_UUID" + + db_params_profile: + name: "EXAMPLE_POSTGRES_HA_PARAMS_NAME" + uuid: "EXAMPLE_POSTGRES_HA_PARAMS_UUID" + +public_ssh_key: "EXAMPLE_PUBLIC_SSH_KEY" + +maintenance: + window_name: "EXAMPLE_MAINTENANCE_WINDOW_NAME" + window_uuid: "EXAMPLE_MAINTENANCE_WINDOW_UUID" + +sla: + name: "EXAMPLE_SLA_NAME" + uuid: "EXAMPLE_SLA_UUID" + +sla2: + name: "EXAMPLE_SLA2_NAME" + uuid: "EXAMPLE_SLA2_UUID" + +cluster: + cluster1: + name: "EXAMPLE_CLUSTER1_NAME" + uuid: "EXAMPLE_CLUSTER1_UUID" + cluster2: + name: "EXAMPLE_CLUSTER2_NAME" + uuid: "EXAMPLE_CLUSTER2_UUID" + cluster3: + name: "EXAMPLE_CLUSTER3_NAME" + uuid: "" + desc: "EXAMPLE_CLUSTER3_DESC" + name_prefix: "EXAMPLE_CLUSTER3_NAME_PREFIX" + cluster_ip: "EXAMPLE_CLUSTER3_IP" + update_cluster_ip: "EXAMPLE_UPDATE_CLUSTER_IP" + cluster_credentials: + username: "EXAMPLE_CLUSTER_CREDENTIALS_USERNAME" + password: "EXAMPLE_CLUSTER_CREDENTIALS_PASSWORD" + agent_network: + dns_servers: + - "EXAMPLE_DNS_SERVER_1" + - "EXAMPLE_DNS_SERVER_2" + ntp_servers: + - "EXAMPLE_NTP_SERVER_1" + - "EXAMPLE_NTP_SERVER_2" + - "EXAMPLE_NTP_SERVER_3" + - "EXAMPLE_NTP_SERVER_4" + vlan_access: + prism_vlan: + vlan_name: "EXAMPLE_PRISM_VLAN_NAME" + vlan_type: "EXAMPLE_VLAN_TYPE" + static_ip: "EXAMPLE_STATIC_IP" + gateway: "EXAMPLE_GATEWAY" + subnet_mask: "EXAMPLE_SUBNET_MASK" + storage_container: "EXAMPLE_STORAGE_CONTAINER" + +vm_password: "EXAMPLE_VM_PASSWORD" +vm_username: "EXAMPLE_VM_USERNAME" + +db_server_vm: + name: "EXAMPLE_DB_SERVER_VM_NAME" + uuid: "EXAMPLE_DB_SERVER_VM_UUID" + +tags: + db_server_vm: + name: "EXAMPLE_DB_SERVER_VM_TAGS_NAME" + uuid: "EXAMPLE_DB_SERVER_VM_TAGS_UUID" + databases: + name: "EXAMPLE_DATABASES_NAME" + uuid: "EXAMPLE_DATABASES_UUID" + clones: + name: "EXAMPLE_CLONES_NAME" + uuid: "EXAMPLE_CLONES_UUID" + +time_machine: + name: "EXAMPLE_TIME_MACHINE_NAME" + uuid: "EXAMPLE_TIME_MACHINE_UUID" + snapshot_uuid: "" + +postgres: + software_home: "EXAMPLE_SOFTWARE_HOME" + +vm_ip: "EXAMPLE_VM_IP" + +cluster_ips: + ip1: "EXAMPLE_IP_1" + ip2: "EXAMPLE_IP_2" + ip3: "EXAMPLE_IP_3" + ip4: "EXAMPLE_IP_4" + ip5: "EXAMPLE_IP_5" + vip: "EXAMPLE_VIP" + +ndb_vlan: + name: "EXAMPLE_NDB_VLAN_NAME" + ip_pools: + - start_ip: "EXAMPLE_START_IP_1" + end_ip: "EXAMPLE_END_IP_1" + - start_ip: "EXAMPLE_START_IP_2" + end_ip: "EXAMPLE_END_IP_2" + - start_ip: "EXAMPLE_START_IP_3" + end_ip: "EXAMPLE_END_IP_3" + - start_ip: "EXAMPLE_START_IP_4" + end_ip: "EXAMPLE_END_IP_4" + gateway: "EXAMPLE_GATEWAY" + subnet_mask: "EXAMPLE_SUBNET_MASK" + primary_dns: "EXAMPLE_PRIMARY_DNS" + secondary_dns: "EXAMPLE_SECONDARY_DNS" + dns_domain: "EXAMPLE_DNS_DOMAIN" + updated_gateway: "EXAMPLE_UPDATED_GATEWAY" + updated_subnet_mask: "EXAMPLE_UPDATED_SUBNET_MASK" + updated_primary_dns: "EXAMPLE_UPDATED_PRIMARY_DNS" + updated_secondary_dns: "EXAMPLE_UPDATED_SECONDARY_DNS" + +todelete: [] + +ndb_ip: "EXAMPLE_NDB_IP" +ndb_username: "EXAMPLE_NDB_USERNAME" +ndb_password: "EXAMPLE_NDB_PASSWORD" From 603a3d154ba1c763bf629518a1fa2b8529a40548 Mon Sep 17 00:00:00 2001 From: Pradeepsingh Bhati Date: Thu, 9 Nov 2023 14:31:05 +0530 Subject: [PATCH 4/5] Add comments to sample var files for simplicity --- README.md | 95 +++---- .../targets/prepare_env/vars/main.yml | 181 ++++++++------ .../prepare_foundation_env/vars/main.yml | 154 ++++++------ .../targets/prepare_ndb_env/vars/main.yml | 233 ++++++++++-------- 4 files changed, 363 insertions(+), 300 deletions(-) diff --git a/README.md b/README.md index 6db825fa9..85bbdd274 100644 --- a/README.md +++ b/README.md @@ -139,51 +139,6 @@ To run this playbook, use ansible-playbook command ansible-playbook ansible-playbook examples/iaas/iaas.yml ``` -# Testing - -## Integration Testing for Ansible Modules - -To conduct integration tests for a specific Ansible module such as the `ntnx_vms` module, the following step-by-step procedures can be followed: - -### Prerequisites -- Ensure you are in the collection directory where the module is located. - -### Setting up Variables -1. Navigate to the `tests/integration/targets` directory within the collection. -2. Define the necessary variables within the feature-specific var files, such as `prepare_env/vars/main.yml`, `prepare_foundation_env/vars/main.yml`,`prepare_ndb_env/tasks/prepare_env.yml`, etc. Note: For Karbon and FC tests, use the PC vars exclusively, as these features rely on this setup. Not all variables are mandatory; define only the required variables for the particular feature to be tested. -3. Run the playbook for the specific feature you intend to test: - - For PC, NDB, and Foundation tests, execute the relevant commands: - ```bash - ansible-playbook prepare_env/tasks/prepare_env.yml - ansible-playbook prepare_ndb_env/tasks/prepare_env.yml - ansible-playbook prepare_foundation_env/tasks/prepare_foundation_env.yml - ``` - Replace 'feature' with the specific feature you aim to test. - -### Running Integration Tests -4. Conduct integration tests for all modules using: - ```bash - ansible-integration - ``` - -5. To perform integration tests for a specific module: - ```bash - ansible-integration module_test_name - ``` - Replace `module_test_name` with the actual module's name. - -### Cleanup -6. After completing the integration tests, perform a cleanup specific to the tested feature: - - For PC tests, execute the command: - ```bash - ansible-playbook prepare_env/tasks/clean_up.yml - ``` - - For Foundation tests, execute the command: - ```bash - ansible-playbook prepare_foundation_env/tasks/clean_up.yml - ``` - -By following these steps, you can perform comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. Define only the necessary variables for the specific feature you intend to test, using PC vars for Karbon and FC tests. # Included Content @@ -305,6 +260,56 @@ We glady welcome contributions from the community. From updating the documentati * [Contributing Guide](CONTRIBUTING.md) * [Code of Conduct](CODE_OF_CONDUCT.md) +# Testing + +## Integration Testing for Nutanix Ansible Modules + +To conduct integration tests for a specific Ansible module such as the `ntnx_vms` module, the following step-by-step procedures can be followed: + +### Prerequisites +- Ensure you are in the installed collection directory where the module is located. For example: +`/Users/pradeep.bhati/.ansible/collections/ansible_collections/nutanix/ncp` + +### Setting up Variables +1. Navigate to the `tests/integration/targets` directory within the collection. + +2. Define the necessary variables within the feature-specific var files, such as `tests/integration/targets/prepare_env/vars/main.yml`, `tests/integration/targets/prepare_foundation_env/vars/main.yml`,`tests/integration/targets/prepare_ndb_env/tasks/prepare_env.yml`, etc. + +Note: For Karbon and FC tests, use the PC vars exclusively, as these features rely on pc setup. Not all variables are mandatory; define only the required variables for the particular feature to be tested. + +3. Run the test setup playbook for the specific feature you intend to test to create entities in setup: + - For PC, NDB, and Foundation tests, execute the relevant commands: + ```bash + ansible-playbook prepare_env/tasks/prepare_env.yml + ansible-playbook prepare_ndb_env/tasks/prepare_env.yml + ansible-playbook prepare_foundation_env/tasks/prepare_foundation_env.yml + ``` + +### Running Integration Tests +1. Conduct integration tests for all modules using: + ```bash + ansible-integration + ``` + +2. To perform integration tests for a specific module: + ```bash + ansible-integration module_test_name + ``` + Replace `module_test_name` with test directory name under tests/integration/targets. + +### Cleanup +1. After completing the integration tests, perform a cleanup specific to the tested feature: + - For PC tests, execute the command: + ```bash + ansible-playbook prepare_env/tasks/clean_up.yml + ``` + - For Foundation tests, execute the command: + ```bash + ansible-playbook prepare_foundation_env/tasks/clean_up.yml + ``` + +By following these steps, you can perform comprehensive integration testing for the specified Ansible module and ensure a clean testing environment afterward. Define only the necessary variables for the specific feature you intend to test. + # Examples ## Playbook for IaaS provisioning on Nutanix diff --git a/tests/integration/targets/prepare_env/vars/main.yml b/tests/integration/targets/prepare_env/vars/main.yml index f9f30952f..508f92c27 100644 --- a/tests/integration/targets/prepare_env/vars/main.yml +++ b/tests/integration/targets/prepare_env/vars/main.yml @@ -1,120 +1,145 @@ -ip: EXAMPLE_IP -username: EXAMPLE_USERNAME -password: EXAMPLE_PASSWORD -validate_certs: false +ip: TEST_PC_IP +username: TEST_PC_USERNAME +password: TEST_PC_PASSWORD +validate_certs: TEST_VALIDATE_CERT_FLAG + +# for NKE related tests +k8s_version: TEST_K8S_VERSION +host_os: TEST_HOST_OS +nutanix_cluster_password: TEST_CLUSTER_PASSWORD +nutanix_cluster_username: TEST_CLUSTER_USERNAME +cni: + node_cidr_mask_size: "TEST_MASK_CIDR" + service_ipv4_cidr: "TEST_SERVICE_CIDR" + pod_ipv4_cidr: "TEST_POD_CIDR" + +# docker registry url for nke tests +url: TEST_REGISTRIES_URL + +# cluster reference for several tests cluster: - name: EXAMPLE_CLUSTER_NAME - uuid: EXAMPLE_CLUSTER_UUID -k8s_version: EXAMPLE_K8S_VERSION -host_os: EXAMPLE_HOST_OS + name: TEST_CLUSTER_NAME + uuid: TEST_CLUSTER_UUID + +# For tests like vms, etc. network: dhcp: - name: EXAMPLE_VLAN_NAME - uuid: EXAMPLE_VLAN_UUID + name: TEST_VLAN_NAME + uuid: TEST_VLAN_UUID static: - ip: EXAMPLE_STATIC_IP -nutanix_cluster_password: EXAMPLE_CLUSTER_PASSWORD -nutanix_cluster_username: EXAMPLE_CLUSTER_USERNAME + ip: TEST_STATIC_IP -cni: - node_cidr_mask_size: "EXAMPLE_MASK_CIDR" - service_ipv4_cidr: "EXAMPLE_SERVICE_CIDR" - pod_ipv4_cidr: "EXAMPLE_POD_CIDR" vm_owner: - name: EXAMPLE_OWNER_NAME - uuid: EXAMPLE_OWNER_UUID + name: TEST_OWNER_NAME + uuid: TEST_OWNER_UUID +# can be skipped todelete: [] +# for ntnx_image tests disk_image: - url: EXAMPLE_IMAGE_URL - dest: EXAMPLE_DEST_PATH - checksum: EXAMPLE_CHECKSUM - centos: "EXAMPLE_CENTOS" + url: TEST_IMAGE_URL + dest: TEST_DEST_PATH + checksum: TEST_CHECKSUM + centos: "TEST_CENTOS" +# used in test setup for creation of networks and some networking tests external_nat_subnets: - name: EXAMPLE_NAT_NAME - vlan_id: EXAMPLE_VLAN_ID - gateway_ip_address: EXAMPLE_GATEWAY_IP - network_prefix: EXAMPLE_PREFIX - network_ip: EXAMPLE_NETWORK_IP + name: TEST_NAT_NAME + vlan_id: TEST_VLAN_ID + gateway_ip_address: TEST_GATEWAY_IP + network_prefix: TEST_PREFIX + network_ip: TEST_NETWORK_IP dhcp: - start_address: EXAMPLE_START_DHCP - end_address: EXAMPLE_END_DHCP + start_address: TEST_START_DHCP + end_address: TEST_END_DHCP static: - start_address: EXAMPLE_START_STATIC - end_address: EXAMPLE_END_STATIC + start_address: TEST_START_STATIC + end_address: TEST_END_STATIC -vpc_name: EXAMPLE_VPC_NAME -vm_name: EXAMPLE_VM_NAME -static_subnet_name: EXAMPLE_STATIC_SUBNET +# Details for creating this resources during test setup and same are used related tests +vpc_name: TEST_VPC_NAME +vm_name: TEST_VM_NAME +static_subnet_name: TEST_STATIC_SUBNET overlay_subnet: - name: EXAMPLE_OVERLAY_NAME - network_ip: EXAMPLE_OVERLAY_NETWORK_IP - network_prefix: EXAMPLE_OVERLAY_PREFIX - gateway_ip: EXAMPLE_OVERLAY_GATEWAY_IP - private_ip: EXAMPLE_OVERLAY_PRIVATE_IP - -quarantine_rule_uuid: EXAMPLE_QUARANTINE_UUID + name: TEST_OVERLAY_NAME + network_ip: TEST_OVERLAY_NETWORK_IP + network_prefix: TEST_OVERLAY_PREFIX + gateway_ip: TEST_OVERLAY_GATEWAY_IP + private_ip: TEST_OVERLAY_PRIVATE_IP + +# security rule related tests +quarantine_rule_uuid: TEST_QUARANTINE_UUID categories: apptiers: - Default - sub_app_1 -centos: "EXAMPLE_CENTOS" -ubuntu: "EXAMPLE_UBUNTU" +# name of images in setup for vms test +centos: "TEST_CENTOS" +ubuntu: "TEST_UBUNTU" + +# virtual switch reference primarily for vms test virtual_switch: - name: EXAMPLE_SWITCH_NAME - uuid: EXAMPLE_SWITCH_UUID + name: TEST_SWITCH_NAME + uuid: TEST_SWITCH_UUID +# storage reference primarily for vms test storage_container: - name: EXAMPLE_CONTAINER_NAME - uuid: EXAMPLE_CONTAINER_UUID + name: TEST_CONTAINER_NAME + uuid: TEST_CONTAINER_UUID +# user and user groups from AD for user and user groups tests users: - - EXAMPLE_USER_UUID_1 - - EXAMPLE_USER_UUID_2 + - TEST_USER_UUID_1 + - TEST_USER_UUID_2 user_groups: - - EXAMPLE_GROUP_UUID + - TEST_GROUP_UUID +# project reference for vms test project: - name: EXAMPLE_PROJECT_NAME - uuid: EXAMPLE_PROJECT_UUID + name: TEST_PROJECT_NAME + uuid: TEST_PROJECT_UUID +# list of roles for advanced projects tests roles: - - "EXAMPLE_ROLES_NAME_1" - - "EXAMPLE_ROLES_NAME_2" - - "EXAMPLE_ROLES_NAME_3" - - "EXAMPLE_ROLES_NAME_4" + - "TEST_ROLES_NAME_1" + - "TEST_ROLES_NAME_2" + - "TEST_ROLES_NAME_3" + - "TEST_ROLES_NAME_4" +# account reference for advanced projects related tests accounts: - name: "NTNX_LOCAL_AZ" - uuid: "EXAMPLE_ACCOUNT_UUID" + uuid: "TEST_ACCOUNT_UUID" -new_user: "EXAMPLE_NEW_USER_EMAIL" - -new_user_group: "EXAMPLE_NEW_USER_GROUP_DN" +# user and user groups for projects tests when new users are to be added +new_user: "TEST_NEW_USER_EMAIL" +new_user_group: "TEST_NEW_USER_GROUP_DN" +# acp tests related vars acp: role: name: "Project Admin" - uuid: EXAMPLE_ROLE_UUID - user_uuid: EXAMPLE_USER_UUID - user_group_uuid: EXAMPLE_GROUP_UUID + uuid: TEST_ROLE_UUID + user_uuid: TEST_USER_UUID + user_group_uuid: TEST_GROUP_UUID + +# auth details for projects, acps, user and user groups related tests +distinguished_name: "TEST_DISTINGUISHED_NAME" +principal_name: "TEST_PRINCIPAL_NAME" +directory_service_uuid: "TEST_DIRECTORY_UUID" +identity_provider_uuid: "TEST_IDENTITY_UUID" -distinguished_name: "EXAMPLE_DISTINGUISHED_NAME" -principal_name: "EXAMPLE_PRINCIPAL_NAME" -directory_service_uuid: "EXAMPLE_DIRECTORY_UUID" -identity_provider_uuid: "EXAMPLE_IDENTITY_UUID" +# vm created during test setup for dr tests +dr_vm_name: TEST_VM_NAME -dr_vm_name: EXAMPLE_VM_NAME +# dr related tests vars dr: - primary_az_url: EXAMPLE_PRIMARY_URL - recovery_az_url: EXAMPLE_RECOVERY_URL - recovery_site_network: "EXAMPLE_RECOVERY_NETWORK" - recovery_ip1: EXAMPLE_RECOVERY_IP1 - recovery_ip2: EXAMPLE_RECOVERY_IP2 - gateway_ip: EXAMPLE_GATEWAY_IP - prefix: EXAMPLE_PREFIX - -url: EXAMPLE_URL + primary_az_url: TEST_PRIMARY_URL + recovery_az_url: TEST_RECOVERY_URL + recovery_site_network: "TEST_RECOVERY_NETWORK" + recovery_ip1: TEST_RECOVERY_IP1 + recovery_ip2: TEST_RECOVERY_IP2 + gateway_ip: TEST_GATEWAY_IP + prefix: TEST_PREFIX diff --git a/tests/integration/targets/prepare_foundation_env/vars/main.yml b/tests/integration/targets/prepare_foundation_env/vars/main.yml index 5ecaf3000..268a046dc 100644 --- a/tests/integration/targets/prepare_foundation_env/vars/main.yml +++ b/tests/integration/targets/prepare_foundation_env/vars/main.yml @@ -1,79 +1,95 @@ -foundation_host: "EXAMPLE_FOUNDATION_HOST" -cvm_gateway: "EXAMPLE_CVM_GATEWAY" -cvm_netmask: "EXAMPLE_CVM_NETMASK" -hypervisor_gateway: "EXAMPLE_HYPERVISOR_GATEWAY" -hypervisor_netmask: "EXAMPLE_HYPERVISOR_NETMASK" -source: 'EXAMPLE_SOURCE_PATH' -image_url: "EXAMPLE_IMAGE_URL" -nos_package: "EXAMPLE_NOS_PACKAGE" -default_ipmi_user: "EXAMPLE_IPMI_USER" +# foundation host to be ued in tests +foundation_host: "TEST_FOUNDATION_HOST" + +# the dir in local machine where test setup will install nos image and pick during image upload tests +source: 'TEST_SOURCE_PATH' + +# nos image url for images tests +image_url: "TEST_IMAGE_URL" + +# nos package name +nos_package: "TEST_NOS_PACKAGE" + +# common details for all nodes used under test +cvm_gateway: "TEST_CVM_GATEWAY" +cvm_netmask: "TEST_CVM_NETMASK" +hypervisor_gateway: "TEST_HYPERVISOR_GATEWAY" +hypervisor_netmask: "TEST_HYPERVISOR_NETMASK" +default_ipmi_user: "TEST_IPMI_USER" + +# IBIS_node is just a random name we used for our tests +# this nodes where used for tests related to bare metal, dos and aos installed nodes. IBIS_node: - block_id: "EXAMPLE_BLOCK_ID" + block_id: "TEST_BLOCK_ID" node1: - node_serial: "EXAMPLE_NODE_SERIAL_1" - hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_1" - cvm_ip: EXAMPLE_CVM_IP_1 - hypervisor_ip: EXAMPLE_HYPERVISOR_IP_1 - node_position: "EXAMPLE_NODE_POSITION_1" - hypervisor: "EXAMPLE_HYPERVISOR_1" - ipmi_password: "EXAMPLE_IPMI_PASSWORD_1" - ipmi_ip: EXAMPLE_IPMI_IP_1 - ipmi_netmask: "EXAMPLE_IPMI_NETMASK_1" - ipmi_gateway: EXAMPLE_IPMI_GATEWAY_1 + node_serial: "TEST_NODE_SERIAL_1" + hypervisor_hostname: "TEST_HYPERVISOR_HOSTNAME_1" + cvm_ip: TEST_CVM_IP_1 + hypervisor_ip: TEST_HYPERVISOR_IP_1 + node_position: "TEST_NODE_POSITION_1" + hypervisor: "TEST_HYPERVISOR_1" + ipmi_password: "TEST_IPMI_PASSWORD_1" + ipmi_ip: TEST_IPMI_IP_1 + ipmi_netmask: "TEST_IPMI_NETMASK_1" + ipmi_gateway: TEST_IPMI_GATEWAY_1 node2: - node_serial: "EXAMPLE_NODE_SERIAL_2" - hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_2" - cvm_ip: EXAMPLE_CVM_IP_2 - hypervisor_ip: EXAMPLE_HYPERVISOR_IP_2 - node_position: "EXAMPLE_NODE_POSITION_2" - hypervisor: "EXAMPLE_HYPERVISOR_2" - ipmi_password: "EXAMPLE_IPMI_PASSWORD_2" - ipmi_ip: EXAMPLE_IPMI_IP_2 + node_serial: "TEST_NODE_SERIAL_2" + hypervisor_hostname: "TEST_HYPERVISOR_HOSTNAME_2" + cvm_ip: TEST_CVM_IP_2 + hypervisor_ip: TEST_HYPERVISOR_IP_2 + node_position: "TEST_NODE_POSITION_2" + hypervisor: "TEST_HYPERVISOR_2" + ipmi_password: "TEST_IPMI_PASSWORD_2" + ipmi_ip: TEST_IPMI_IP_2 node3: - node_serial: "EXAMPLE_NODE_SERIAL_3" - hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_3" - cvm_ip: EXAMPLE_CVM_IP_3 - hypervisor_ip: EXAMPLE_HYPERVISOR_IP_3 - node_position: "EXAMPLE_NODE_POSITION_3" - hypervisor: "EXAMPLE_HYPERVISOR_3" - ipmi_password: "EXAMPLE_IPMI_PASSWORD_3" - ipmi_ip: EXAMPLE_IPMI_IP_3 + node_serial: "TEST_NODE_SERIAL_3" + hypervisor_hostname: "TEST_HYPERVISOR_HOSTNAME_3" + cvm_ip: TEST_CVM_IP_3 + hypervisor_ip: TEST_HYPERVISOR_IP_3 + node_position: "TEST_NODE_POSITION_3" + hypervisor: "TEST_HYPERVISOR_3" + ipmi_password: "TEST_IPMI_PASSWORD_3" + ipmi_ip: TEST_IPMI_IP_3 node4: - node_serial: "EXAMPLE_NODE_SERIAL_4" - hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_4" - cvm_ip: EXAMPLE_CVM_IP_4 - hypervisor_ip: EXAMPLE_HYPERVISOR_IP_4 - node_position: "EXAMPLE_NODE_POSITION_4" - hypervisor: "EXAMPLE_HYPERVISOR_4" - ipmi_password: "EXAMPLE_IPMI_PASSWORD_4" - ipmi_ip: EXAMPLE_IPMI_IP_4 + node_serial: "TEST_NODE_SERIAL_4" + hypervisor_hostname: "TEST_HYPERVISOR_HOSTNAME_4" + cvm_ip: TEST_CVM_IP_4 + hypervisor_ip: TEST_HYPERVISOR_IP_4 + node_position: "TEST_NODE_POSITION_4" + hypervisor: "TEST_HYPERVISOR_4" + ipmi_password: "TEST_IPMI_PASSWORD_4" + ipmi_ip: TEST_IPMI_IP_4 + +# we used this nodes for our sanity tests. nodes: - current_cvm_vlan_tag: "EXAMPLE_CVM_VLAN_TAG" - block_id: "EXAMPLE_BLOCK_ID_NODES" + current_cvm_vlan_tag: "TEST_CVM_VLAN_TAG" + block_id: "TEST_BLOCK_ID_NODES" node1: - cvm_ip: EXAMPLE_CVM_IP_NODE1 - hypervisor: "EXAMPLE_HYPERVISOR_NODE1" - hypervisor_ip: EXAMPLE_HYPERVISOR_IP_NODE1 - node_position: "EXAMPLE_NODE_POSITION_NODE1" - hypervisor_hostname: "EXAMPLE_HYPERVISOR_HOSTNAME_NODE1" - node_serial: "EXAMPLE_NODE_SERIAL_NODE1" - ipmi_password: "EXAMPLE_IPMI_PASSWORD_NODE1" - ipmi_ip: EXAMPLE_IPMI_IP_NODE1 - ipmi_netmask: "EXAMPLE_IPMI_NETMASK_NODE1" - ipmi_gateway: EXAMPLE_IPMI_GATEWAY_NODE1 + cvm_ip: TEST_CVM_IP_NODE1 + hypervisor: "TEST_HYPERVISOR_NODE1" + hypervisor_ip: TEST_HYPERVISOR_IP_NODE1 + node_position: "TEST_NODE_POSITION_NODE1" + hypervisor_hostname: "TEST_HYPERVISOR_HOSTNAME_NODE1" + node_serial: "TEST_NODE_SERIAL_NODE1" + ipmi_password: "TEST_IPMI_PASSWORD_NODE1" + ipmi_ip: TEST_IPMI_IP_NODE1 + ipmi_netmask: "TEST_IPMI_NETMASK_NODE1" + ipmi_gateway: TEST_IPMI_GATEWAY_NODE1 ntp_servers: - - "EXAMPLE_NTP_SERVER_1" - - "EXAMPLE_NTP_SERVER_2" + - "TEST_NTP_SERVER_1" + - "TEST_NTP_SERVER_2" dns_servers: - - "EXAMPLE_DNS_SERVER_1" - - "EXAMPLE_DNS_SERVER_2" - backplane_vlan: "EXAMPLE_BACKPLANE_VLAN" - backplane_subnet: "EXAMPLE_BACKPLANE_SUBNET" - backplane_netmask: "EXAMPLE_BACKPLANE_NETMASK" + - "TEST_DNS_SERVER_1" + - "TEST_DNS_SERVER_2" + backplane_vlan: "TEST_BACKPLANE_VLAN" + backplane_subnet: "TEST_BACKPLANE_SUBNET" + backplane_netmask: "TEST_BACKPLANE_NETMASK" + +# this is for bmc ipmi config related tests bmc: - ipmi_user: "EXAMPLE_IPMI_USER_BMC" - ipmi_password: "EXAMPLE_IPMI_PASSWORD_BMC" - ipmi_netmask: "EXAMPLE_IPMI_NETMASK_BMC" - ipmi_gateway: EXAMPLE_IPMI_GATEWAY_BMC - ipmi_mac: "EXAMPLE_IPMI_MAC" - ipmi_ip: EXAMPLE_IPMI_IP_BMC + ipmi_user: "TEST_IPMI_USER_BMC" + ipmi_password: "TEST_IPMI_PASSWORD_BMC" + ipmi_netmask: "TEST_IPMI_NETMASK_BMC" + ipmi_gateway: TEST_IPMI_GATEWAY_BMC + ipmi_mac: "TEST_IPMI_MAC" + ipmi_ip: TEST_IPMI_IP_BMC diff --git a/tests/integration/targets/prepare_ndb_env/vars/main.yml b/tests/integration/targets/prepare_ndb_env/vars/main.yml index 5fdce068e..bc3e181b2 100644 --- a/tests/integration/targets/prepare_ndb_env/vars/main.yml +++ b/tests/integration/targets/prepare_ndb_env/vars/main.yml @@ -1,167 +1,184 @@ +# details for setup to be used in tests +ndb_ip: "NDB_HOST_IP" +ndb_username: "NDB_USERNAME" +ndb_password: "NDB_PASSWORD" + +# network profile for various ndb tests. All vars are related to NDB setup. network_profile: - name: "EXAMPLE_NETWORK_PROFILE_NAME" - uuid: "EXAMPLE_NETWORK_PROFILE_UUID" + name: "TEST_NETWORK_PROFILE_NAME" + uuid: "TEST_NETWORK_PROFILE_UUID" single: cluster: - name: "EXAMPLE_CLUSTER_NAME" - vlan_name: "EXAMPLE_VLAN_NAME" + name: "TEST_CLUSTER_NAME" + vlan_name: "TEST_VLAN_NAME" HA: cluster1: - name: "EXAMPLE_CLUSTER1_NAME" - vlan_name: "EXAMPLE_VLAN_NAME" - vlan_name2: "EXAMPLE_VLAN_NAME" + name: "TEST_CLUSTER1_NAME" + vlan_name: "TEST_VLAN_NAME" + vlan_name2: "TEST_VLAN_NAME" cluster2: - name: "EXAMPLE_CLUSTER2_NAME" - vlan_name: "EXAMPLE_VLAN_NAME" - vlan_name2: "EXAMPLE_VLAN_NAME" + name: "TEST_CLUSTER2_NAME" + vlan_name: "TEST_VLAN_NAME" + vlan_name2: "TEST_VLAN_NAME" +# profiles for single node postgres database instances software_profile: - name: "EXAMPLE_SOFTWARE_PROFILE_NAME" - uuid: "EXAMPLE_SOFTWARE_PROFILE_UUID" - latest_version_id: "EXAMPLE_LATEST_VERSION_ID" + name: "TEST_SOFTWARE_PROFILE_NAME" + uuid: "TEST_SOFTWARE_PROFILE_UUID" + latest_version_id: "TEST_LATEST_VERSION_ID" compute_profile: - name: "EXAMPLE_COMPUTE_PROFILE_NAME" - uuid: "EXAMPLE_COMPUTE_PROFILE_UUID" + name: "TEST_COMPUTE_PROFILE_NAME" + uuid: "TEST_COMPUTE_PROFILE_UUID" db_params_profile: - name: "EXAMPLE_DB_PARAMS_PROFILE_NAME" - uuid: "EXAMPLE_DB_PARAMS_PROFILE_UUID" + name: "TEST_DB_PARAMS_PROFILE_NAME" + uuid: "TEST_DB_PARAMS_PROFILE_UUID" static_network_profile: - name: "EXAMPLE_STATIC_NETWORK_PROFILE_NAME" - uuid: "EXAMPLE_STATIC_NETWORK_PROFILE_UUID" + name: "TEST_STATIC_NETWORK_PROFILE_NAME" + uuid: "TEST_STATIC_NETWORK_PROFILE_UUID" +# for postgres HA related tests, requires different profiles then single node ones. postgres_ha_profiles: static_network_profile: - name: "EXAMPLE_STATIC_HA_STATIC_NAME" - uuid: "EXAMPLE_STATIC_HA_STATIC_UUID" + name: "TEST_STATIC_HA_STATIC_NAME" + uuid: "TEST_STATIC_HA_STATIC_UUID" multicluster_network_profile: - name: "EXAMPLE_HA_MULTICLUSTER_NAME" - uuid: "EXAMPLE_HA_MULTICLUSTER_UUID" + name: "TEST_HA_MULTICLUSTER_NAME" + uuid: "TEST_HA_MULTICLUSTER_UUID" software_profile: - name: "EXAMPLE_POSTGRES_SOFTWARE_PROFILE_NAME" - uuid: "EXAMPLE_POSTGRES_SOFTWARE_PROFILE_UUID" - latest_version_id: "EXAMPLE_LATEST_VERSION_ID" + name: "TEST_POSTGRES_SOFTWARE_PROFILE_NAME" + uuid: "TEST_POSTGRES_SOFTWARE_PROFILE_UUID" + latest_version_id: "TEST_LATEST_VERSION_ID" compute_profile: - name: "EXAMPLE_COMPUTE_PROFILE_NAME" - uuid: "EXAMPLE_COMPUTE_PROFILE_UUID" + name: "TEST_COMPUTE_PROFILE_NAME" + uuid: "TEST_COMPUTE_PROFILE_UUID" db_params_profile: - name: "EXAMPLE_POSTGRES_HA_PARAMS_NAME" - uuid: "EXAMPLE_POSTGRES_HA_PARAMS_UUID" + name: "TEST_POSTGRES_HA_PARAMS_NAME" + uuid: "TEST_POSTGRES_HA_PARAMS_UUID" -public_ssh_key: "EXAMPLE_PUBLIC_SSH_KEY" +public_ssh_key: "TEST_PUBLIC_SSH_KEY" +# reference for existing maintenance window to be added in certain entities like database instance, etc. maintenance: - window_name: "EXAMPLE_MAINTENANCE_WINDOW_NAME" - window_uuid: "EXAMPLE_MAINTENANCE_WINDOW_UUID" + window_name: "TEST_MAINTENANCE_WINDOW_NAME" + window_uuid: "TEST_MAINTENANCE_WINDOW_UUID" +# reference for existing sla to be used in certain entities like database instance, etc. sla: - name: "EXAMPLE_SLA_NAME" - uuid: "EXAMPLE_SLA_UUID" + name: "TEST_SLA_NAME" + uuid: "TEST_SLA_UUID" +# reference for existing sla to be used in certain entities like database instance, etc. sla2: - name: "EXAMPLE_SLA2_NAME" - uuid: "EXAMPLE_SLA2_UUID" + name: "TEST_SLA2_NAME" + uuid: "TEST_SLA2_UUID" +# reference for clusters for various tests +# cluster3 here is used for clusters crud tests cluster: cluster1: - name: "EXAMPLE_CLUSTER1_NAME" - uuid: "EXAMPLE_CLUSTER1_UUID" + name: "TEST_CLUSTER1_NAME" + uuid: "TEST_CLUSTER1_UUID" cluster2: - name: "EXAMPLE_CLUSTER2_NAME" - uuid: "EXAMPLE_CLUSTER2_UUID" + name: "TEST_CLUSTER2_NAME" + uuid: "TEST_CLUSTER2_UUID" cluster3: - name: "EXAMPLE_CLUSTER3_NAME" + name: "TEST_CLUSTER3_NAME" uuid: "" - desc: "EXAMPLE_CLUSTER3_DESC" - name_prefix: "EXAMPLE_CLUSTER3_NAME_PREFIX" - cluster_ip: "EXAMPLE_CLUSTER3_IP" - update_cluster_ip: "EXAMPLE_UPDATE_CLUSTER_IP" + desc: "TEST_CLUSTER3_DESC" + name_prefix: "TEST_CLUSTER3_NAME_PREFIX" + cluster_ip: "TEST_CLUSTER3_IP" + update_cluster_ip: "TEST_UPDATE_CLUSTER_IP" cluster_credentials: - username: "EXAMPLE_CLUSTER_CREDENTIALS_USERNAME" - password: "EXAMPLE_CLUSTER_CREDENTIALS_PASSWORD" + username: "TEST_CLUSTER_CREDENTIALS_USERNAME" + password: "TEST_CLUSTER_CREDENTIALS_PASSWORD" agent_network: dns_servers: - - "EXAMPLE_DNS_SERVER_1" - - "EXAMPLE_DNS_SERVER_2" + - "TEST_DNS_SERVER_1" + - "TEST_DNS_SERVER_2" ntp_servers: - - "EXAMPLE_NTP_SERVER_1" - - "EXAMPLE_NTP_SERVER_2" - - "EXAMPLE_NTP_SERVER_3" - - "EXAMPLE_NTP_SERVER_4" + - "TEST_NTP_SERVER_1" + - "TEST_NTP_SERVER_2" + - "TEST_NTP_SERVER_3" + - "TEST_NTP_SERVER_4" vlan_access: prism_vlan: - vlan_name: "EXAMPLE_PRISM_VLAN_NAME" - vlan_type: "EXAMPLE_VLAN_TYPE" - static_ip: "EXAMPLE_STATIC_IP" - gateway: "EXAMPLE_GATEWAY" - subnet_mask: "EXAMPLE_SUBNET_MASK" - storage_container: "EXAMPLE_STORAGE_CONTAINER" - -vm_password: "EXAMPLE_VM_PASSWORD" -vm_username: "EXAMPLE_VM_USERNAME" - + vlan_name: "TEST_PRISM_VLAN_NAME" + vlan_type: "TEST_VLAN_TYPE" + static_ip: "TEST_STATIC_IP" + gateway: "TEST_GATEWAY" + subnet_mask: "TEST_SUBNET_MASK" + storage_container: "TEST_STORAGE_CONTAINER" + +# free IPs from cluster.cluster1 for HA related tests +cluster_ips: + ip1: "TEST_IP_1" + ip2: "TEST_IP_2" + ip3: "TEST_IP_3" + ip4: "TEST_IP_4" + ip5: "TEST_IP_5" + vip: "TEST_VIP" + +# for new db server vms +vm_password: "TEST_VM_PASSWORD" +vm_username: "TEST_VM_USERNAME" + +# exitsing db server VM reference for software profile tests db_server_vm: - name: "EXAMPLE_DB_SERVER_VM_NAME" - uuid: "EXAMPLE_DB_SERVER_VM_UUID" + name: "TEST_DB_SERVER_VM_NAME" + uuid: "TEST_DB_SERVER_VM_UUID" +# existing tags for various entities tags: db_server_vm: - name: "EXAMPLE_DB_SERVER_VM_TAGS_NAME" - uuid: "EXAMPLE_DB_SERVER_VM_TAGS_UUID" + name: "TEST_DB_SERVER_VM_TAGS_NAME" + uuid: "TEST_DB_SERVER_VM_TAGS_UUID" databases: - name: "EXAMPLE_DATABASES_NAME" - uuid: "EXAMPLE_DATABASES_UUID" + name: "TEST_DATABASES_NAME" + uuid: "TEST_DATABASES_UUID" clones: - name: "EXAMPLE_CLONES_NAME" - uuid: "EXAMPLE_CLONES_UUID" + name: "TEST_CLONES_NAME" + uuid: "TEST_CLONES_UUID" +# existing time machine info for data access management and snapshot related tests time_machine: - name: "EXAMPLE_TIME_MACHINE_NAME" - uuid: "EXAMPLE_TIME_MACHINE_UUID" + name: "TEST_TIME_MACHINE_NAME" + uuid: "TEST_TIME_MACHINE_UUID" snapshot_uuid: "" +# for brownfield import of vms postgres: - software_home: "EXAMPLE_SOFTWARE_HOME" - -vm_ip: "EXAMPLE_VM_IP" + software_home: "/usr/pgsql-10.4" -cluster_ips: - ip1: "EXAMPLE_IP_1" - ip2: "EXAMPLE_IP_2" - ip3: "EXAMPLE_IP_3" - ip4: "EXAMPLE_IP_4" - ip5: "EXAMPLE_IP_5" - vip: "EXAMPLE_VIP" +# ip for creating database vm using static network +vm_ip: "TEST_VM_IP" +# info for vlan related tests ndb_vlan: - name: "EXAMPLE_NDB_VLAN_NAME" + name: "TEST_VLAN_IN_CLUSTER" ip_pools: - - start_ip: "EXAMPLE_START_IP_1" - end_ip: "EXAMPLE_END_IP_1" - - start_ip: "EXAMPLE_START_IP_2" - end_ip: "EXAMPLE_END_IP_2" - - start_ip: "EXAMPLE_START_IP_3" - end_ip: "EXAMPLE_END_IP_3" - - start_ip: "EXAMPLE_START_IP_4" - end_ip: "EXAMPLE_END_IP_4" - gateway: "EXAMPLE_GATEWAY" - subnet_mask: "EXAMPLE_SUBNET_MASK" - primary_dns: "EXAMPLE_PRIMARY_DNS" - secondary_dns: "EXAMPLE_SECONDARY_DNS" - dns_domain: "EXAMPLE_DNS_DOMAIN" - updated_gateway: "EXAMPLE_UPDATED_GATEWAY" - updated_subnet_mask: "EXAMPLE_UPDATED_SUBNET_MASK" - updated_primary_dns: "EXAMPLE_UPDATED_PRIMARY_DNS" - updated_secondary_dns: "EXAMPLE_UPDATED_SECONDARY_DNS" - -todelete: [] - -ndb_ip: "EXAMPLE_NDB_IP" -ndb_username: "EXAMPLE_NDB_USERNAME" -ndb_password: "EXAMPLE_NDB_PASSWORD" + - start_ip: "TEST_START_IP_1" + end_ip: "TEST_END_IP_1" + - start_ip: "TEST_START_IP_2" + end_ip: "TEST_END_IP_2" + - start_ip: "TEST_START_IP_3" + end_ip: "TEST_END_IP_3" + - start_ip: "TEST_START_IP_4" + end_ip: "TEST_END_IP_4" + gateway: "TEST_GATEWAY" + subnet_mask: "TEST_SUBNET_MASK" + primary_dns: "TEST_PRIMARY_DNS" + secondary_dns: "TEST_SECONDARY_DNS" + dns_domain: "TEST_DNS_DOMAIN" + updated_gateway: "TEST_UPDATED_GATEWAY" + updated_subnet_mask: "TEST_UPDATED_SUBNET_MASK" + updated_primary_dns: "TEST_UPDATED_PRIMARY_DNS" + updated_secondary_dns: "TEST_UPDATED_SECONDARY_DNS" + +todelete: [] \ No newline at end of file From bb0cc44783cd396ec1f660a5c06cf90c1c06fb0a Mon Sep 17 00:00:00 2001 From: Pradeepsingh Bhati Date: Thu, 9 Nov 2023 14:39:53 +0530 Subject: [PATCH 5/5] Minor typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 85bbdd274..d32b1714c 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ To conduct integration tests for a specific Ansible module such as the `ntnx_vms ### Prerequisites - Ensure you are in the installed collection directory where the module is located. For example: -`/Users/pradeep.bhati/.ansible/collections/ansible_collections/nutanix/ncp` +`/Users/mac.user1/.ansible/collections/ansible_collections/nutanix/ncp` ### Setting up Variables 1. Navigate to the `tests/integration/targets` directory within the collection.