diff options
author | Gonéri Le Bouder <goneri@lebouder.net> | 2019-05-02 23:19:02 -0400 |
---|---|---|
committer | ansibot <ansibot@users.noreply.github.com> | 2019-05-02 23:19:01 -0400 |
commit | affaedfca8c14f70968a8d2a6c898c488adaa55a (patch) | |
tree | 8e46bc3b7b05af665c56fc59fcfa8136403ccd51 /test/integration/targets/vmware_vcenter_statistics | |
parent | 2ef8b297ffdb98613b3d64791828e760fb2193c4 (diff) | |
download | ansible-affaedfca8c14f70968a8d2a6c898c488adaa55a.tar.gz |
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
Diffstat (limited to 'test/integration/targets/vmware_vcenter_statistics')
-rw-r--r-- | test/integration/targets/vmware_vcenter_statistics/aliases | 1 | ||||
-rw-r--r-- | test/integration/targets/vmware_vcenter_statistics/tasks/main.yml | 107 |
2 files changed, 43 insertions, 65 deletions
diff --git a/test/integration/targets/vmware_vcenter_statistics/aliases b/test/integration/targets/vmware_vcenter_statistics/aliases index 32dd9d5345..eb39c07bac 100644 --- a/test/integration/targets/vmware_vcenter_statistics/aliases +++ b/test/integration/targets/vmware_vcenter_statistics/aliases @@ -1,2 +1,3 @@ shippable/vcenter/group1 cloud/vcenter +needs/target/prepare_vmware_tests diff --git a/test/integration/targets/vmware_vcenter_statistics/tasks/main.yml b/test/integration/targets/vmware_vcenter_statistics/tasks/main.yml index 65fe611b36..98afb59bd3 100644 --- a/test/integration/targets/vmware_vcenter_statistics/tasks/main.yml +++ b/test/integration/targets/vmware_vcenter_statistics/tasks/main.yml @@ -2,44 +2,30 @@ # 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) -- name: Wait for Flask controller to come up online - wait_for: - host: "{{ vcsim }}" - port: 5000 - state: started +- import_role: + name: prepare_vmware_tests -- name: kill vcsim - uri: - url: http://{{ vcsim }}:5000/killall - -- name: start vcsim - uri: - url: http://{{ vcsim }}:5000/spawn?cluster=2 - register: vcsim_instance - -- debug: - var: vcsim_instance - -- name: Wait for vcsim server to come up online - wait_for: - host: "{{ vcsim }}" - port: 443 - state: started - -- name: get datacenter - uri: - url: http://{{ vcsim }}:5000/govc_find?filter=DC - register: datacenters - -- name: get a datacenter - set_fact: - dc1: "{{ datacenters.json[0] | basename }}" +- 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: - hostname: "{{ vcsim }}" - username: "{{ vcsim_instance.json.username }}" - password: "{{ vcsim_instance.json.password }}" + vmware_vcenter_statistics: &stats + hostname: "{{ vcenter_hostname }}" + username: "{{ vcenter_username }}" + password: "{{ vcenter_password }}" interval_past_day: enabled: true interval_minutes: 5 @@ -64,46 +50,37 @@ register: statistics_results_check_mode check_mode: yes -- debug: msg="{{ statistics_results_check_mode }}" +- 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.changed == False + # 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: - hostname: "{{ vcsim }}" - username: "{{ vcsim_instance.json.username }}" - password: "{{ vcsim_instance.json.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 + <<: *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: msg="{{ statistics_results }}" +- debug: var=statistics_results - 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.changed == False + - not (statistics_results is changed) + when: vcsim is not defined |