| 1 |
# Test code for the vmware_vcenter_statistics module. |
| 2 |
# Copyright: (c) 2018, Christian Kotte <[email protected]> |
| 3 |
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 4 |
|
| 5 |
- import_role: |
| 6 |
name: prepare_vmware_tests |
| 7 |
|
| 8 |
- name: Disable all the statistics |
| 9 |
vmware_vcenter_statistics: |
| 10 |
hostname: "{{ vcenter_hostname }}" |
| 11 |
username: "{{ vcenter_username }}" |
| 12 |
password: "{{ vcenter_password }}" |
| 13 |
interval_past_day: |
| 14 |
enabled: false |
| 15 |
interval_past_week: |
| 16 |
enabled: false |
| 17 |
interval_past_month: |
| 18 |
enabled: false |
| 19 |
interval_past_year: |
| 20 |
enabled: false |
| 21 |
validate_certs: false |
| 22 |
register: statistics_results_check_mode |
| 23 |
|
| 24 |
- name: Configure statistics in check mode |
| 25 |
vmware_vcenter_statistics: &stats |
| 26 |
hostname: "{{ vcenter_hostname }}" |
| 27 |
username: "{{ vcenter_username }}" |
| 28 |
password: "{{ vcenter_password }}" |
| 29 |
interval_past_day: |
| 30 |
enabled: true |
| 31 |
interval_minutes: 5 |
| 32 |
save_for_days: 3 |
| 33 |
level: 2 |
| 34 |
interval_past_week: |
| 35 |
enabled: true |
| 36 |
interval_minutes: 30 |
| 37 |
save_for_weeks: 1 |
| 38 |
level: 2 |
| 39 |
interval_past_month: |
| 40 |
enabled: true |
| 41 |
interval_hours: 2 |
| 42 |
save_for_months: 1 |
| 43 |
level: 1 |
| 44 |
interval_past_year: |
| 45 |
enabled: true |
| 46 |
interval_days: 1 |
| 47 |
save_for_years: 1 |
| 48 |
level: 1 |
| 49 |
validate_certs: false |
| 50 |
register: statistics_results_check_mode |
| 51 |
check_mode: true |
| 52 |
|
| 53 |
- debug: var=statistics_results_check_mode |
| 54 |
|
| 55 |
- name: ensure statistics were configured |
| 56 |
assert: |
| 57 |
that: |
| 58 |
- statistics_results_check_mode is changed |
| 59 |
|
| 60 |
- name: Configure statistics |
| 61 |
vmware_vcenter_statistics: |
| 62 |
<<: *stats |
| 63 |
register: statistics_results |
| 64 |
|
| 65 |
- debug: var=statistics_results |
| 66 |
|
| 67 |
- name: ensure statistics were configured |
| 68 |
assert: |
| 69 |
that: |
| 70 |
- statistics_results is changed |
| 71 |
|
| 72 |
- name: Configure statistics (again) |
| 73 |
vmware_vcenter_statistics: |
| 74 |
<<: *stats |
| 75 |
register: statistics_results |
| 76 |
|
| 77 |
- debug: var=statistics_results |
| 78 |
|
| 79 |
- name: ensure statistics were configured |
| 80 |
assert: |
| 81 |
that: |
| 82 |
- not (statistics_results is changed) |
| 83 |
|
| 84 |
- name: Configure statistics intervall to level 2 for later check |
| 85 |
vmware_vcenter_statistics: |
| 86 |
hostname: "{{ vcenter_hostname }}" |
| 87 |
username: "{{ vcenter_username }}" |
| 88 |
password: "{{ vcenter_password }}" |
| 89 |
interval_past_day: |
| 90 |
enabled: true |
| 91 |
level: 2 |
| 92 |
interval_past_week: |
| 93 |
enabled: true |
| 94 |
level: 2 |
| 95 |
interval_past_month: |
| 96 |
enabled: true |
| 97 |
level: 2 |
| 98 |
interval_past_year: |
| 99 |
enabled: true |
| 100 |
level: 2 |
| 101 |
validate_certs: false |
| 102 |
|
| 103 |
- name: Increase daily and weekly while decrease monthly and yearly |
| 104 |
vmware_vcenter_statistics: |
| 105 |
hostname: "{{ vcenter_hostname }}" |
| 106 |
username: "{{ vcenter_username }}" |
| 107 |
password: "{{ vcenter_password }}" |
| 108 |
interval_past_day: |
| 109 |
enabled: true |
| 110 |
level: 3 |
| 111 |
interval_past_week: |
| 112 |
enabled: true |
| 113 |
level: 3 |
| 114 |
interval_past_month: |
| 115 |
enabled: true |
| 116 |
level: 1 |
| 117 |
interval_past_year: |
| 118 |
enabled: true |
| 119 |
level: 1 |
| 120 |
validate_certs: false |
| 121 |
register: statistics_results_mixed_increase_decrease |
| 122 |
|
| 123 |
- name: Ensure statistics were configured |
| 124 |
assert: |
| 125 |
that: |
| 126 |
- statistics_results_mixed_increase_decrease is changed |