2017-08-28 18:36:46 +02:00
|
|
|
# Test code for the vmware_resource_pool module.
|
2017-11-06 17:28:15 +01:00
|
|
|
# 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)
|
|
|
|
|
2019-04-24 21:11:47 +02:00
|
|
|
- import_role:
|
|
|
|
name: prepare_vmware_tests
|
|
|
|
vars:
|
|
|
|
setup_attach_host: true
|
|
|
|
setup_datastore: true
|
2017-08-28 18:36:46 +02:00
|
|
|
|
|
|
|
# Testcase 0001: Add Resource pool
|
|
|
|
- name: add resource pool
|
|
|
|
vmware_resource_pool:
|
|
|
|
validate_certs: False
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-08-28 18:36:46 +02:00
|
|
|
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
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-08-28 18:36:46 +02:00
|
|
|
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
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-08-28 18:36:46 +02:00
|
|
|
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
|
2019-04-24 21:11:47 +02:00
|
|
|
hostname: "{{ vcenter_hostname }}"
|
|
|
|
username: "{{ vcenter_username }}"
|
|
|
|
password: "{{ vcenter_password }}"
|
2017-08-28 18:36:46 +02:00
|
|
|
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 }}"
|