Skip to content

Commit

Permalink
Fix integration tests (#1941) (#1943)
Browse files Browse the repository at this point in the history
stable-3.x: Fix integration tests

SUMMARY
Fix integration tests
Backport of #1941
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
vmware_about_info
vmware_category
vmware_dvs_portgroup
vmware_folder_info
vmware_guest_controller
vmware_guest_network
ADDITIONAL INFORMATION
  • Loading branch information
mariolenz authored Dec 5, 2023
1 parent d39400d commit 0342339
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions tests/integration/targets/vmware_about_info/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

- assert:
that:
- about.about_info["{{ item }}"] is defined
- about.about_info[item] is defined
with_items:
- api_type
- api_version
Expand All @@ -40,7 +40,7 @@

- assert:
that:
- about.about_info["{{ item }}"] is defined
- about.about_info[item] is defined
with_items:
- api_type
- api_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
- name: Check if we get correct associable datatype for {{ category_name }}
assert:
that:
- "'{{ expected_result }}' in {{ category_datatype }}"
- "expected_result in category_datatype"
4 changes: 2 additions & 2 deletions tests/integration/targets/vmware_dvs_portgroup/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
assert:
that:
- not dvs_pg_result_0013.changed
- "'vlan_id range 1-4096 specified is incorrect. The valid vlan_id range is from 0 to 4094.' == '{{ dvs_pg_result_0013.msg }}'"
- "'vlan_id range 1-4096 specified is incorrect. The valid vlan_id range is from 0 to 4094.' == dvs_pg_result_0013.msg"

- name: Change VLAN on basic VLAN portgroup
community.vmware.vmware_dvs_portgroup:
Expand Down Expand Up @@ -508,7 +508,7 @@
assert:
that:
- not dvs_pg_result_0018.changed
- "'No private vlan with id 10 in distributed vSwitch {{ dvswitch1 }}' == '{{ dvs_pg_result_0018.msg }}'"
- "'No private vlan with id 10 in distributed vSwitch {{ dvswitch1 }}' == dvs_pg_result_0018.msg"

- name: Run tests and clean up
block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

- assert:
that:
- "{{ item }} is defined"
- "item is defined"
with_items:
- folder_info_0001['folder_info']
- folder_info_0001['flat_folder_info']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
assert:
that:
- "add_disk_controller.changed == true"
- "{{ add_disk_controller.disk_controller_data.scsi | length | int }} == {{ scsi_num | int + 1 }}"
- "{{ add_disk_controller.disk_controller_data.sata | length | int }} == {{ sata_num | int + 1 }}"
- "add_disk_controller.disk_controller_data.scsi | length | int == scsi_num | int + 1"
- "add_disk_controller.disk_controller_data.sata | length | int == sata_num | int + 1"

- name: delete specified disk controllers
vmware_guest_controller:
Expand All @@ -76,5 +76,5 @@
assert:
that:
- "del_disk_controller.changed == true"
- "{{ del_disk_controller.disk_controller_data.sata | length | int }} == {{ sata_num | int }}"
- "{{ del_disk_controller.disk_controller_data.scsi | length | int }} == {{ scsi_num | int }}"
- "del_disk_controller.disk_controller_data.sata | length | int == sata_num | int"
- "del_disk_controller.disk_controller_data.scsi | length | int == scsi_num | int"
20 changes: 10 additions & 10 deletions tests/integration/targets/vmware_guest_network/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
assert:
that:
- add_netadapter is changed
- "{{ add_netadapter.results[1].network_info | length | int }} == {{ netadapter_num | int + 2 }}"
- "add_netadapter.results[1].network_info | length | int == netadapter_num | int + 2"

- name: delete one specified network adapter
community.vmware.vmware_guest_network:
Expand All @@ -108,7 +108,7 @@
assert:
that:
- del_netadapter is changed
- "{{ del_netadapter.network_info | length | int }} == {{ netadapter_num | int + 1 }}"
- "del_netadapter.network_info | length | int == netadapter_num | int + 1"

- name: get instance uuid of virtual machines
community.vmware.vmware_guest_info:
Expand Down Expand Up @@ -142,7 +142,7 @@
assert:
that:
- add_netadapter_instanceuuid is changed
- "{{ add_netadapter_instanceuuid.network_info | length | int }} == {{ netadapter_num | int + 2 }}"
- "add_netadapter_instanceuuid.network_info | length | int == netadapter_num | int + 2"

- name: delete one specified network adapter
community.vmware.vmware_guest_network:
Expand All @@ -159,7 +159,7 @@
assert:
that:
- del_netadapter is changed
- "{{ del_netadapter.network_info | length | int }} == {{ netadapter_num | int + 1 }}"
- "del_netadapter.network_info | length | int == netadapter_num | int + 1"

- name: delete again one specified network adapter (idempotency)
community.vmware.vmware_guest_network:
Expand All @@ -178,7 +178,7 @@
assert:
that:
- not (del_again_netadapter is changed)
- "{{ del_again_netadapter.network_info | length | int }} == {{ netadapter_num | int + 1 }}"
- "del_again_netadapter.network_info | length | int == netadapter_num | int + 1"

- name: disable DirectPath I/O on a Vmxnet3 adapter
community.vmware.vmware_guest_network:
Expand Down Expand Up @@ -226,7 +226,7 @@
assert:
that:
- disc_netadapter is changed
- "{{ disc_netadapter.network_info[netadapter_num | int]['connected'] }} == false"
- "disc_netadapter.network_info[netadapter_num | int]['connected'] == false"

- name: Check if network does not exists
community.vmware.vmware_guest_network:
Expand Down Expand Up @@ -396,7 +396,7 @@
- name: check that there's no adapters left
assert:
that:
- "{{ nic_info2.network_info | length | int }} == 0"
- "nic_info2.network_info | length | int == 0"

- name: add new adapter(s)
community.vmware.vmware_guest_network:
Expand All @@ -412,7 +412,7 @@
- name: check that nic was created
assert:
that:
- "{{ new_nic.network_info | length | int }} > 0"
- "new_nic.network_info | length | int > 0"

- name: add new PVRDMA adapter
community.vmware.vmware_guest_network:
Expand All @@ -429,7 +429,7 @@
- name: check that PVRDMA nic was created
assert:
that:
- "{{ new_nic_pvrdma.network_info | length | int }} == {{ new_nic.network_info | length | int + 1 }}"
- "new_nic_pvrdma.network_info | length | int == new_nic.network_info | length | int + 1"

- name: remove PVRDMA adapter
community.vmware.vmware_guest_network:
Expand All @@ -445,7 +445,7 @@
- name: check that PVRDMA nic was removed
assert:
that:
- "{{ new_nic_pvrdma.network_info | length | int - 1 }} == {{ remove_nic_pvrdma.network_info | length | int }}"
- "new_nic_pvrdma.network_info | length | int - 1 == remove_nic_pvrdma.network_info | length | int"

# https://github.com/ansible-collections/community.vmware/issues/204
- name: "Change a dvpg with in same DVS(integration test for 204)"
Expand Down

0 comments on commit 0342339

Please sign in to comment.