From e87c33b54f158beb04992ffc7568d450e78f5314 Mon Sep 17 00:00:00 2001 From: CircuitCipher <3893074+CircuitCipher@users.noreply.github.com> Date: Fri, 6 Sep 2024 09:10:06 -0400 Subject: [PATCH] Fix zabbix_authentication int tests for 6.0 server --- .../fix-zabbix-authentication-passwd-check-rules.yml | 1 + tests/integration/targets/setup_zabbix/tasks/main.yml | 4 ++-- .../zabbix_authentication_test_passwd_check_rules.yml | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/changelogs/fragments/fix-zabbix-authentication-passwd-check-rules.yml b/changelogs/fragments/fix-zabbix-authentication-passwd-check-rules.yml index c68b2d083..73996dfc1 100644 --- a/changelogs/fragments/fix-zabbix-authentication-passwd-check-rules.yml +++ b/changelogs/fragments/fix-zabbix-authentication-passwd-check-rules.yml @@ -1,2 +1,3 @@ bugfixes: - zabbix_authentication - fix inability to update passwd_check_rules + - zabbix_authentication - fix inability to set passwd_check_rules to empty list diff --git a/tests/integration/targets/setup_zabbix/tasks/main.yml b/tests/integration/targets/setup_zabbix/tasks/main.yml index fd7f6a700..60937fc0b 100644 --- a/tests/integration/targets/setup_zabbix/tasks/main.yml +++ b/tests/integration/targets/setup_zabbix/tasks/main.yml @@ -50,8 +50,8 @@ status_code: 200 retries: 60 delay: 5 - until: check_login_result is defined and 'json' in check_login_result and 'result' in check_login_result.json - register: check_login_result + until: check_login_under64_result is defined and 'json' in check_login_under64_result and 'result' in check_login_under64_result.json + register: check_login_under64_result when: zabbix_version is version('6.4', '<') - name: check login to zabbix for Zabbix >= 6.4 diff --git a/tests/integration/targets/test_zabbix_authentication/tasks/zabbix_authentication_test_passwd_check_rules.yml b/tests/integration/targets/test_zabbix_authentication/tasks/zabbix_authentication_test_passwd_check_rules.yml index 102596321..0b1a36960 100644 --- a/tests/integration/targets/test_zabbix_authentication/tasks/zabbix_authentication_test_passwd_check_rules.yml +++ b/tests/integration/targets/test_zabbix_authentication/tasks/zabbix_authentication_test_passwd_check_rules.yml @@ -3,6 +3,10 @@ community.zabbix.zabbix_authentication: passwd_check_rules: "avoid_easy_to_guess" +- name: Set the login result based on current zabbix version + set_fact: + login_result: "{{ check_login_under64_result if zabbix_version is version('6.4', '<') else check_login_result }}" + - name: Get the authentication rules ansible.builtin.uri: url: "{{ zabbix_api_server_url }}/api_jsonrpc.php" @@ -12,12 +16,11 @@ method: "authentication.get" params: {} id: "1" - auth: "{{ check_login_result.json.result }}" + auth: "{{ login_result.json.result }}" body_format: json status_code: 200 register: get_auth_result - # Internally the value of 8 represents an "avoid_easy_to_guess" rule - name: Assert that the passwd_check_rules is 8 (avoid_easy_to_guess) ansible.builtin.assert: @@ -37,12 +40,11 @@ method: "authentication.get" params: {} id: "1" - auth: "{{ check_login_result.json.result }}" + auth: "{{ login_result.json.result }}" body_format: json status_code: 200 register: get_auth_result - # Internally the value of 0 represents an empty password check rule set - name: Assert that the passwd_check_rules is empty ansible.builtin.assert: