mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
UCS Server UUID pool modules and integration tests (#41743)
* UCS Server UUID pool modules and integration tests * change version added to 2.7 * Doc and result changed updates from review.
This commit is contained in:
parent
f8f22f77ed
commit
5f5fbffe8a
3 changed files with 332 additions and 0 deletions
7
test/integration/targets/ucs_uuid_pool/aliases
Normal file
7
test/integration/targets/ucs_uuid_pool/aliases
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Not enabled, but can be used with the UCS Platform Emulator or UCS hardware.
|
||||
# Example integration_config.yml:
|
||||
# ---
|
||||
# ucs_hostname: 172.16.143.136
|
||||
# ucs_username: admin
|
||||
# ucs_password: password
|
||||
unsupported
|
128
test/integration/targets/ucs_uuid_pool/tasks/main.yml
Normal file
128
test/integration/targets/ucs_uuid_pool/tasks/main.yml
Normal file
|
@ -0,0 +1,128 @@
|
|||
# Test code for the UCS modules
|
||||
# Copyright 2018, David Soper (@dsoper2)
|
||||
|
||||
- name: Test that we have a UCS host, UCS username, and UCS password
|
||||
fail:
|
||||
msg: 'Please define the following variables: ucs_hostname, ucs_username and ucs_password.'
|
||||
when: ucs_hostname is not defined or ucs_username is not defined or ucs_password is not defined
|
||||
vars:
|
||||
login_info: &login_info
|
||||
hostname: "{{ ucs_hostname }}"
|
||||
username: "{{ ucs_username }}"
|
||||
password: "{{ ucs_password }}"
|
||||
|
||||
# Setup (clean environment)
|
||||
- name: Server UUID Pools absent
|
||||
ucs_uuid_pool: &uuid_pool_absent
|
||||
<<: *login_info
|
||||
name: UUID-Pool
|
||||
state: absent
|
||||
|
||||
|
||||
# Test present (check_mode)
|
||||
- name: Server UUID Pools present (check_mode)
|
||||
ucs_uuid_pool: &uuid_pool_present
|
||||
<<: *login_info
|
||||
name: UUID-Pool
|
||||
order: sequential
|
||||
first_uuid: 0000-000000000001
|
||||
last_uuid: 0000-000000000078
|
||||
check_mode: yes
|
||||
register: cm_uuid_pool_present
|
||||
|
||||
|
||||
# Present (normal mode)
|
||||
- name: Server UUID Pools present (normal mode)
|
||||
ucs_uuid_pool: *uuid_pool_present
|
||||
register: nm_uuid_pool_present
|
||||
|
||||
|
||||
# Test present again (idempotent)
|
||||
- name: Server UUID Pools present again (check_mode)
|
||||
ucs_uuid_pool: *uuid_pool_present
|
||||
check_mode: yes
|
||||
register: cm_uuid_pool_present_again
|
||||
|
||||
|
||||
# Present again (normal mode)
|
||||
- name: Server UUID Pools present again (normal mode)
|
||||
ucs_uuid_pool: *uuid_pool_present
|
||||
register: nm_uuid_pool_present_again
|
||||
|
||||
|
||||
# Verfiy present
|
||||
- name: Verify Server UUID Pools present results
|
||||
assert:
|
||||
that:
|
||||
- cm_uuid_pool_present.changed == nm_uuid_pool_present.changed == true
|
||||
- cm_uuid_pool_present_again.changed == nm_uuid_pool_present_again.changed == false
|
||||
|
||||
|
||||
# Test change (check_mode)
|
||||
- name: Server UUID Pools description change (check_mode)
|
||||
ucs_uuid_pool: &uuid_pool_change
|
||||
<<: *uuid_pool_present
|
||||
descr: Testing Ansible
|
||||
check_mode: yes
|
||||
register: cm_uuid_pool_descr_change
|
||||
|
||||
|
||||
# Change (normal mode)
|
||||
- name: Server UUID Pools description change (normal mode)
|
||||
ucs_uuid_pool: *uuid_pool_change
|
||||
register: nm_uuid_pool_descr_change
|
||||
|
||||
|
||||
# Test change again (idempotent)
|
||||
- name: Server UUID Pools description again (check_mode)
|
||||
ucs_uuid_pool: *uuid_pool_change
|
||||
check_mode: yes
|
||||
register: cm_uuid_pool_descr_change_again
|
||||
|
||||
|
||||
# Change again (normal mode)
|
||||
- name: Server UUID Pools description change again (normal mode)
|
||||
ucs_uuid_pool: *uuid_pool_change
|
||||
register: nm_uuid_pool_descr_change_again
|
||||
|
||||
|
||||
# Verfiy change
|
||||
- name: Verify Server UUID Pools change results
|
||||
assert:
|
||||
that:
|
||||
- cm_uuid_pool_descr_change.changed == nm_uuid_pool_descr_change.changed == true
|
||||
- cm_uuid_pool_descr_change_again.changed == nm_uuid_pool_descr_change_again.changed == false
|
||||
|
||||
|
||||
# Teardown (clean environment)
|
||||
- name: Server UUID Pools absent (check_mode)
|
||||
ucs_uuid_pool: *uuid_pool_absent
|
||||
check_mode: yes
|
||||
register: cm_uuid_pool_absent
|
||||
|
||||
|
||||
# Absent (normal mode)
|
||||
- name: Server UUID Pools absent (normal mode)
|
||||
ucs_uuid_pool: *uuid_pool_absent
|
||||
register: nm_uuid_pool_absent
|
||||
|
||||
|
||||
# Test absent again (idempotent)
|
||||
- name: Server UUID Pools absent again (check_mode)
|
||||
ucs_uuid_pool: *uuid_pool_absent
|
||||
check_mode: yes
|
||||
register: cm_uuid_pool_absent_again
|
||||
|
||||
|
||||
# Absent again (normal mode)
|
||||
- name: Server UUID Pools absent again (normal mode)
|
||||
ucs_uuid_pool: *uuid_pool_absent
|
||||
register: nm_uuid_pool_absent_again
|
||||
|
||||
|
||||
# Verfiy absent
|
||||
- name: Verify Server UUID Pools absent results
|
||||
assert:
|
||||
that:
|
||||
- cm_uuid_pool_absent.changed == nm_uuid_pool_absent.changed == true
|
||||
- cm_uuid_pool_absent_again.changed == nm_uuid_pool_absent_again.changed == false
|
Loading…
Add table
Add a link
Reference in a new issue