ansible/test/integration/targets/vmware_vcenter_statistics/tasks/main.yml
Gonéri Le Bouder affaedfca8 vmware: refactoring of vmware test roles -- part7 (#55732)
Refactoring of the following roles to make use of the new
`prepare_vmware_tests` role.

- `vmware_resource_pool`
- `vmware_resource_pool_facts`
- `vmware_target_canonical_facts`
- `vmware_vcenter_settings`
- `vmware_vcenter_statistics`
- `vmware_vm_facts`
- `vmware_vm_host_drs_rule`
- `vmware_vm_vm_drs_rule`
- `vmware_vmkernel`
- `vmware_vmkernel_facts`
- `vmware_vspan_session`
- `vmware_vswitch`
- `vmware_vswitch_facts`

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

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

86 lines
2.2 KiB
YAML

# Test code for the vmware_vcenter_statistics module.
# Copyright: (c) 2018, Christian Kotte <christian.kotte@gmx.de>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
- import_role:
name: prepare_vmware_tests
- name: Disable all the statistics
vmware_vcenter_statistics:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
interval_past_day:
enabled: false
interval_past_week:
enabled: false
interval_past_month:
enabled: false
interval_past_year:
enabled: false
validate_certs: no
register: statistics_results_check_mode
- name: Configure statistics in check mode
vmware_vcenter_statistics: &stats
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
interval_past_day:
enabled: true
interval_minutes: 5
save_for_days: 3
level: 2
interval_past_week:
enabled: true
interval_minutes: 30
save_for_weeks: 1
level: 2
interval_past_month:
enabled: true
interval_hours: 2
save_for_months: 1
level: 1
interval_past_year:
enabled: true
interval_days: 1
save_for_years: 1
level: 1
validate_certs: no
register: statistics_results_check_mode
check_mode: yes
- debug: var=statistics_results_check_mode
- name: ensure statistics were configured
assert:
that:
# Doesn't really work with vcsim. No matter which settings are used; they are always shown as already configured!?
- statistics_results_check_mode is changed
when: vcsim is not defined
- name: Configure statistics
vmware_vcenter_statistics:
<<: *stats
register: statistics_results
- debug: var=statistics_results
- name: ensure statistics were configured
assert:
that:
- statistics_results is changed
when: vcsim is not defined
- name: Configure statistics (again)
vmware_vcenter_statistics:
<<: *stats
register: statistics_results
- debug: var=statistics_results
- name: ensure statistics were configured
assert:
that:
- not (statistics_results is changed)
when: vcsim is not defined