1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/vmware_resource_pool/tasks/main.yml
Gonéri Le Bouder 39d1794ed9 vmware: refactoring of vmware test roles -- part6
Refactoring of the following roles to make use of the new
`prepare_vmware_tests` role.

- `vmware_inventory`
- `vmware_local_role_facts`
- `vmware_local_role_manager`
- `vmware_local_user_facts`
- `vmware_local_user_manager`
- `vmware_maintenancemode`
- `vmware_portgroup_facts`
- `vmware_resource_pool`
- `vmware_resource_pool_facts`

This patch depends on: https://github.com/ansible/ansible/pull/55719

Original PR: https://github.com/ansible/ansible/pull/54882
2019-05-02 09:28:01 -04:00

99 lines
2.7 KiB
YAML

# Test code for the vmware_resource_pool module.
# Copyright: (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- import_role:
name: prepare_vmware_tests
vars:
setup_attach_host: true
setup_datastore: true
# Testcase 0001: Add Resource pool
- name: add resource pool
vmware_resource_pool:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ dc1 }}"
cluster: "{{ ccr1 }}"
resource_pool: test_resource_0001
mem_shares: normal
mem_limit: -1
mem_reservation: 0
mem_expandable_reservations: True
cpu_shares: normal
cpu_limit: -1
cpu_reservation: 0
cpu_expandable_reservations: True
state: present
register: resource_result_0001
- name: ensure a resource pool is present
assert:
that:
- "{{ resource_result_0001.changed == true }}"
# Testcase 0002: Add Resource pool again
- name: add resource pool again
vmware_resource_pool:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ dc1 }}"
cluster: "{{ ccr1 }}"
resource_pool: test_resource_0001
mem_shares: normal
mem_limit: -1
mem_reservation: 0
mem_expandable_reservations: True
cpu_shares: normal
cpu_limit: -1
cpu_reservation: 0
cpu_expandable_reservations: True
state: present
register: resource_result_0002
- name: check if nothing is changed
assert:
that:
- "{{ resource_result_0002.changed == false }}"
# Testcase 0003: Remove Resource pool
- name: add resource pool again
vmware_resource_pool:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ dc1 }}"
cluster: "{{ ccr1 }}"
resource_pool: test_resource_0001
state: absent
register: resource_result_0003
- name: check if resource pool is removed
assert:
that:
- "{{ resource_result_0003.changed == true }}"
# Testcase 0004: Remove Resource pool again
- name: add resource pool again
vmware_resource_pool:
validate_certs: False
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
datacenter: "{{ dc1 }}"
cluster: "{{ ccr1 }}"
resource_pool: test_resource_0001
state: absent
register: resource_result_0004
- name: check if resource pool is already removed
assert:
that:
- "{{ resource_result_0004.changed == false }}"