ansible/test/integration/targets/vmware_resource_pool/tasks/main.yml

100 lines
2.7 KiB
YAML
Raw Normal View History

# 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 }}"