-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07a9611
commit 114c0c3
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
tests/integration/targets/vmware_rest_appliance/tasks/appliance_system.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
- name: Get the VCSA version | ||
vmware.vmware_rest.appliance_system_version_info: | ||
register: version_result | ||
|
||
- name: Debug VCSA Version | ||
ansible.builtin.debug: | ||
var: version_result | ||
|
||
- name: Validate VCSA Version Info | ||
ansible.builtin.assert: | ||
that: | ||
- version_result is defined and version_result is not none # Ensure version_result is returned | ||
- version_result.value is defined and version_result.value is not none # Ensure value field exists | ||
- "'build' in version_result.value" # Ensure 'build' key exists | ||
- "'version' in version_result.value" # Ensure 'version' key exists | ||
- "'product' in version_result.value" # Ensure 'product' key exists | ||
- "'install_time' in version_result.value" # Ensure 'install_time' key exists | ||
- "'summary' in version_result.value" # Ensure 'summary' key exists | ||
- "'releasedate' in version_result.value" # Ensure 'releasedate' key exists | ||
- version_result.value.version is regex('^\d+\.\d+\.\d+.*$') # Validate 'version' matches semantic versioning | ||
- version_result.value.product == "VMware vCenter Server" # Ensure product is VMware vCenter Server | ||
- version_result.value.type is defined and version_result.value.type == "vCenter Server with an embedded Platform Services Controller" # Check product type | ||
|
||
- name: Check if the system is up to date | ||
vmware.vmware_rest.appliance_update_info: | ||
register: update_result | ||
|
||
- name: Debug Update Info | ||
ansible.builtin.debug: | ||
var: update_result | ||
|
||
- name: Validate Update Info | ||
ansible.builtin.assert: | ||
that: | ||
- update_result is defined and update_result is not none # Ensure update_result is returned | ||
- update_result.value is defined and update_result.value is not none # Ensure value field exists | ||
- "'state' in update_result.value" # Ensure 'state' key exists | ||
- update_result.value.state == 'UP_TO_DATE' # Ensure the system is fully up-to-date | ||
fail_msg: "The system is not up-to-date. Current state: {{ update_result.value.state }}" |
20 changes: 20 additions & 0 deletions
20
tests/integration/targets/vmware_rest_appliance/tasks/appliance_time.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
- name: Get the current time | ||
vmware.vmware_rest.appliance_system_time_info: | ||
register: result | ||
|
||
- name: Debug Output | ||
ansible.builtin.debug: | ||
var: result | ||
|
||
- name: Validate Time Info | ||
ansible.builtin.assert: | ||
that: | ||
- result is defined and result is not none # Ensure result is returned | ||
- result.value is defined and result.value is not none # Ensure the value field is returned | ||
- "'date' in result.value" # Ensure the 'date' key exists | ||
- "'time' in result.value" # Ensure the 'time' key exists | ||
- "'seconds_since_epoch' in result.value" # Ensure the 'seconds_since_epoch' key exists | ||
- "'timezone' in result.value" # Ensure the 'timezone' key exists | ||
- result.value.time is regex('^\d{2}:\d{2}:\d{2} [AP]M$') # Validate 'time' matches 12-hour clock format | ||
- result.value.date is regex('^[A-Za-z]{3} \d{2}-\d{2}-\d{4}$') # Validate 'date' matches format "Wed 12-18-2024" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters