Skip to content

Commit

Permalink
fix CI tests for module_defaults and zabbix_poller services (#437)
Browse files Browse the repository at this point in the history
* fix CI tests for module_defaults and zabbix_poller services

* fixed wrong flag - template_info plugins supports check mode

* override zabbix poller trigger name only for 5.0
  • Loading branch information
D3DeFi authored Aug 9, 2021
1 parent 8d288d8 commit 89f0147
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion plugins/modules/zabbix_template_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def main():
))
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=False
supports_check_mode=True
)

template_name = module.params['template_name']
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/targets/test_zabbix_action/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

- name: test - simple actions
module_defaults:
zabbix_action:
community.zabbix.zabbix_action:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -255,7 +255,7 @@

- name: test - trigger actions with conditions
module_defaults:
zabbix_action:
community.zabbix.zabbix_action:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -507,7 +507,7 @@

- name: test - trigger actions with operations
module_defaults:
zabbix_action:
community.zabbix.zabbix_action:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -659,7 +659,7 @@

- name: test - discovery actions
module_defaults:
zabbix_action:
community.zabbix.zabbix_action:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -820,7 +820,7 @@

- name: test - auto registration actions
module_defaults:
zabbix_action:
community.zabbix.zabbix_action:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -911,7 +911,7 @@

- name: test - internal actions
module_defaults:
zabbix_action:
community.zabbix.zabbix_action:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -1015,7 +1015,7 @@
when:
- zabbix_version is version('3.4', '>=')
module_defaults:
zabbix_action:
community.zabbix.zabbix_action:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

- name: test - Zabbix discovery rule
module_defaults:
zabbix_discovery_rule:
community.zabbix.zabbix_discovery_rule:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

- name: "test - Set default parameters to zabbix_host_info"
module_defaults:
zabbix_host_info:
community.zabbix.zabbix_host_info:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down
12 changes: 6 additions & 6 deletions tests/integration/targets/test_zabbix_mediatype/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: test - email mediatypes
module_defaults:
zabbix_mediatype:
community.zabbix.zabbix_mediatype:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -313,7 +313,7 @@

- name: test - script mediatypes
module_defaults:
zabbix_mediatype:
community.zabbix.zabbix_mediatype:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -378,7 +378,7 @@

- name: test - sms mediatypes
module_defaults:
zabbix_mediatype:
community.zabbix.zabbix_mediatype:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -448,7 +448,7 @@
- name: test - jabber mediatypes
when: zabbix_version is version('4.2', '<=')
module_defaults:
zabbix_mediatype:
community.zabbix.zabbix_mediatype:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -486,7 +486,7 @@
- name: test - ez_texting mediatypes
when: zabbix_version is version('4.2', '<=')
module_defaults:
zabbix_mediatype:
community.zabbix.zabbix_mediatype:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down Expand Up @@ -536,7 +536,7 @@
- name: test - email mediatypes
when: zabbix_version is version('4.4', '>=')
module_defaults:
zabbix_mediatype:
community.zabbix.zabbix_mediatype:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
service_example_trigger: "Zabbix http poller processes more than 75% busy"
23 changes: 14 additions & 9 deletions tests/integration/targets/test_zabbix_service/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
that:
- update_calculate_sla_idempotency_check_result.changed is sameas false

- name: "Override trigger_name for different version of Zabbix"
set_fact:
service_example_trigger: "Zabbix server: Utilization of http poller processes over 75%"
when: zabbix_version is version("5.0", "==")

- name: "test - Update trigger_host and trigger_name with check_mode"
zabbix_service:
server_url: "{{ zabbix_server_url }}"
Expand All @@ -140,7 +145,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
state: present
check_mode: yes
register: update_trigger_name_check_mode_result
Expand All @@ -158,7 +163,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
state: present
register: update_trigger_name_result

Expand All @@ -175,7 +180,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
state: present
register: update_trigger_name_idempotency_check_result

Expand All @@ -192,7 +197,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
algorithm: all_children
state: present
check_mode: yes
Expand All @@ -211,7 +216,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
algorithm: all_children
state: present
register: update_algorithm_result
Expand All @@ -229,7 +234,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
algorithm: all_children
state: present
register: update_algorithm_idempotency_check_result
Expand Down Expand Up @@ -261,7 +266,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
algorithm: all_children
parent: ExampleServiceForServiceModuleRoot
state: present
Expand All @@ -281,7 +286,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
algorithm: all_children
parent: ExampleServiceForServiceModuleRoot
state: present
Expand All @@ -300,7 +305,7 @@
sla: 99.999
calculate_sla: yes
trigger_host: "Zabbix server"
trigger_name: "Zabbix http poller processes more than 75% busy"
trigger_name: "{{ service_example_trigger }}"
algorithm: all_children
parent: ExampleServiceForServiceModuleRoot
state: present
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

- name: test - Zabbix user group
module_defaults:
zabbix_usergroup:
community.zabbix.zabbix_usergroup:
server_url: "{{ zabbix_server_url }}"
login_user: "{{ zabbix_login_user }}"
login_password: "{{ zabbix_login_password }}"
Expand Down

0 comments on commit 89f0147

Please sign in to comment.