diff --git a/tests/integration/files/includes/vars/global.yml b/tests/integration/files/includes/vars/global.yml index e56ed6faf..f243be9f5 100644 --- a/tests/integration/files/includes/vars/global.yml +++ b/tests/integration/files/includes/vars/global.yml @@ -16,8 +16,12 @@ checkmk_server_edition_mapping: cce: cloud cme: managed -ansible_lookup_checkmk_server_url: "{{ checkmk_var_server_url }}" -ansible_lookup_checkmk_site: "{{ outer_item.site }}" -ansible_lookup_checkmk_automation_user: "{{ checkmk_var_automation_user }}" -ansible_lookup_checkmk_automation_secret: "{{ checkmk_var_automation_secret }}" + +# This is a very hacky workaround, as it is not possible to assign variables +# to other variables when using them in lookup modules. +ansible_lookup_checkmk_server_url: "http://127.0.0.1" +ansible_lookup_checkmk_site: "stable_cee" # This is especially hacky. + # All integration tests were adapted to run the specific task only on this site. +ansible_lookup_checkmk_automation_user: "cmkadmin" +ansible_lookup_checkmk_automation_secret: "Sup3rSec4et!" ansible_lookup_checkmk_validate_certs: false diff --git a/tests/integration/targets/lookup_bakery/tasks/test.yml b/tests/integration/targets/lookup_bakery/tasks/test.yml index 034b88552..a24572023 100644 --- a/tests/integration/targets/lookup_bakery/tasks/test.yml +++ b/tests/integration/targets/lookup_bakery/tasks/test.yml @@ -22,17 +22,13 @@ ("'exception' in looked_up_bakery.msg") - name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." - ansible.builtin.debug: - msg: "Bakery status is {{ bakery }}" + ansible.builtin.assert: + that: ("'finished' in bakery.msg") or + ("'running' in bakery.msg") or + ("'initialized' in bakery.msg") or + ("'stopped' in bakery.msg") or + ("'exception' in bakery.msg") vars: bakery: "{{ lookup('checkmk.general.bakery') }}" delegate_to: localhost - register: looked_up_bakery - -- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify bakery status." - ansible.builtin.assert: - that: ("'finished' in looked_up_bakery.msg") or - ("'running' in looked_up_bakery.msg") or - ("'initialized' in looked_up_bakery.msg") or - ("'stopped' in looked_up_bakery.msg") or - ("'exception' in looked_up_bakery.msg") + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_folder/tasks/test.yml b/tests/integration/targets/lookup_folder/tasks/test.yml index f028883c9..11522c352 100644 --- a/tests/integration/targets/lookup_folder/tasks/test.yml +++ b/tests/integration/targets/lookup_folder/tasks/test.yml @@ -65,3 +65,4 @@ extensions: "{{ lookup('checkmk.general.folder', checkmk_folder.path) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_folders/tasks/test.yml b/tests/integration/targets/lookup_folders/tasks/test.yml index 8852389d4..f7109c8bc 100644 --- a/tests/integration/targets/lookup_folders/tasks/test.yml +++ b/tests/integration/targets/lookup_folders/tasks/test.yml @@ -64,7 +64,7 @@ delegate_to: localhost run_once: true # noqa run-once[task] -- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Verify number of folders." +- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call." ansible.builtin.assert: # The looked up list contains the main folder, as well. that: "( 1 + checkmk_var_folders|length ) == folders|length" @@ -72,3 +72,4 @@ folders: "{{ lookup('checkmk.general.folders', '/', recursive=True) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_host/tasks/test.yml b/tests/integration/targets/lookup_host/tasks/test.yml index e10ac167d..c5f98fb5f 100644 --- a/tests/integration/targets/lookup_host/tasks/test.yml +++ b/tests/integration/targets/lookup_host/tasks/test.yml @@ -52,3 +52,4 @@ extensions: "{{ lookup('checkmk.general.host', checkmk_host.name) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_hosts/tasks/test.yml b/tests/integration/targets/lookup_hosts/tasks/test.yml index e9b50d1e7..8642c7ad3 100644 --- a/tests/integration/targets/lookup_hosts/tasks/test.yml +++ b/tests/integration/targets/lookup_hosts/tasks/test.yml @@ -52,3 +52,4 @@ folders: "{{ lookup('checkmk.general.hosts') }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_rules/tasks/test.yml b/tests/integration/targets/lookup_rules/tasks/test.yml index eda80fa72..3189b24af 100644 --- a/tests/integration/targets/lookup_rules/tasks/test.yml +++ b/tests/integration/targets/lookup_rules/tasks/test.yml @@ -103,6 +103,7 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ cpu_load_ruleset.rules }}" + when: outer_item.edition == "stable_cee" - name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: rules." ansible.builtin.assert: @@ -113,3 +114,4 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ checkmk_rulesets }}" + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_rulesets/tasks/test.yml b/tests/integration/targets/lookup_rulesets/tasks/test.yml index 94eb8d998..4055ea615 100644 --- a/tests/integration/targets/lookup_rulesets/tasks/test.yml +++ b/tests/integration/targets/lookup_rulesets/tasks/test.yml @@ -90,6 +90,7 @@ delegate_to: localhost run_once: true # noqa run-once[task] loop: "{{ checkmk_ruleset_regexes }}" + when: outer_item.edition == "stable_cee" - name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Use variables outside the module call: rulesets." ansible.builtin.debug: @@ -98,3 +99,4 @@ rulesets: "{{ lookup('checkmk.general.rulesets', regex='file', rulesets_used=False, rulesets_deprecated=False) }}" delegate_to: localhost run_once: true # noqa run-once[task] + when: outer_item.edition == "stable_cee" diff --git a/tests/integration/targets/lookup_version/tasks/test.yml b/tests/integration/targets/lookup_version/tasks/test.yml index 63142308f..49dfb9ae7 100644 --- a/tests/integration/targets/lookup_version/tasks/test.yml +++ b/tests/integration/targets/lookup_version/tasks/test.yml @@ -24,3 +24,4 @@ version: "{{ lookup('checkmk.general.version') }}" delegate_to: localhost register: looked_up_version + when: outer_item.edition == "stable_cee"