Skip to content

Commit

Permalink
Clean up and trim integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-checkmk committed Sep 5, 2024
1 parent dc3d223 commit fd6ed64
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 177 deletions.
43 changes: 14 additions & 29 deletions tests/integration/targets/site/tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,21 @@
loop: "{{ outer_item.remote_sites }}"
loop_control:
label: "{{ item.site_id }}"

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Enable Livestatus of remote sites."
ansible.builtin.command: "omd config {{ item.site_id }} set LIVEPROXYD on"
when: (download_pass is defined and download_pass | length) or outer_item.edition == "cre"
loop: "{{ outer_item.remote_sites }}"
loop_control:
label: "{{ item.site_id }}"

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Configure Livestatus port of remote sites."
ansible.builtin.command: "omd config {{ item.site_id }} set LIVESTATUS_TCP_PORT {{ item.site_config.status_connection.connection.port }}"
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Configure Sites." # noqa no-changed-when
become: true
ansible.builtin.shell: |
set -o pipefail
omd config {{ item.site_id }} set LIVEPROXYD on
omd config {{ item.site_id }} set LIVESTATUS_TCP_PORT {{ item.site_config.status_connection.connection.port }}
omd config {{ item.site_id }} set LIVESTATUS_TCP_TLS off
args:
executable: /bin/bash
when: (download_pass is defined and download_pass | length) or outer_item.edition == "cre"
loop: "{{ outer_item.remote_sites }}"
loop_control:
label: "{{ item.site_id }}"

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Configure Livestatus TLS of remote sites."
ansible.builtin.command: "omd config {{ item.site_id }} set LIVESTATUS_TCP_TLS off"
when: ((download_pass is defined and download_pass | length) or outer_item.edition == "cre" ) and
item.site_config.status_connection.connection.encrypted == true
loop: "{{ outer_item.remote_sites }}"
loop_control:
label: "{{ item.site_id }}"

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Start Apache2."
ansible.builtin.service:
name: apache2
state: started

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Start Sites."
ansible.builtin.shell: "omd status -b {{ item.site_id }} || omd start {{ item.site_id }}"
register: site_status
Expand Down Expand Up @@ -77,7 +64,7 @@
label: "{{ item.site_id }}"
run_once: true # noqa run-once[task]

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Create site connection. 2nd."
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Create site connection again."
site:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ outer_item.site }}"
Expand All @@ -92,8 +79,6 @@
loop_control:
label: "{{ item.site_id }}"
run_once: true # noqa run-once[task]
#register: result
#failed_when: result.changed | bool

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Log in to remote site."
site:
Expand All @@ -111,7 +96,7 @@
label: "{{ item.site_id }}"
run_once: true # noqa run-once[task]

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Log in to remote site. 2nd."
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Log in to remote site again."
site:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ outer_item.site }}"
Expand Down Expand Up @@ -147,7 +132,7 @@
label: "{{ item.site_id }}"
run_once: true # noqa run-once[task]

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Update remote site. 2nd"
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Update remote site again. "
site:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ outer_item.site }}"
Expand Down Expand Up @@ -181,7 +166,7 @@
label: "{{ item.site_id }}"
run_once: true # noqa run-once[task]

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Log out from remote site. 2nd."
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Log out from remote site again."
site:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ outer_item.site }}"
Expand Down Expand Up @@ -211,7 +196,7 @@
label: "{{ item.site_id }}"
run_once: true # noqa run-once[task]

- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Delete remote site. 2nd."
- name: "{{ outer_item.version }} - {{ outer_item.edition | upper }} - Delete remote site again."
site:
server_url: "{{ checkmk_var_server_url }}"
site: "{{ outer_item.site }}"
Expand Down
174 changes: 26 additions & 148 deletions tests/integration/targets/site/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,12 @@ test_sites:
edition: "cme"
site: "stable_cme"
remote_sites:
#- site_id: "stable_cme_r1"
# site_config:
# status_connection:
# connection:
# socket_type: "tcp"
# port: 6561
# encrypted: false
# host: "localhost"
# verify: false
# proxy:
# use_livestatus_daemon: "direct"
# connect_timeout: 2
# status_host:
# status_host_set: "disabled"
# url_prefix: "/stable_cme_r1/"
# configuration_connection:
# enable_replication: false
# url_of_remote_site: "http://localhost/stable_cme_r1/check_mk/"
# basic_settings:
# site_id: "stable_cme_r1"
# customer: "provider"
# alias: "stable_cme remote site 1"
# authentication:
# username: "cmkadmin"
# password: "{{ checkmk_var_automation_secret }}"
- site_id: "stable_cme_r2"
- site_id: "stable_cme_r1"
site_config:
status_connection:
connection:
socket_type: "tcp"
port: 6562
port: 6561
encrypted: true
host: "localhost"
verify: false
Expand All @@ -43,23 +18,23 @@ test_sites:
connect_timeout: 2
status_host:
status_host_set: "disabled"
url_prefix: "/stable_cme_r2/"
url_prefix: "/stable_cme_r1/"
configuration_connection:
enable_replication: true
url_of_remote_site: "http://localhost/stable_cme_r2/check_mk/"
url_of_remote_site: "http://localhost/stable_cme_r1/check_mk/"
basic_settings:
site_id: "stable_cme_r2"
site_id: "stable_cme_r1"
customer: "provider"
alias: "stable_cme remote site 2"
alias: "stable_cme remote site 1"
authentication:
username: "cmkadmin"
password: "{{ checkmk_var_automation_secret }}"
- site_id: "stable_cme_r3"
- site_id: "stable_cme_r2"
site_config:
status_connection:
connection:
socket_type: "tcp"
port: 6563
port: 6562
encrypted: true
host: "localhost"
verify: false
Expand All @@ -69,31 +44,31 @@ test_sites:
connect_timeout: 2
status_host:
status_host_set: "disabled"
url_prefix: "/stable_cme_r3/"
url_prefix: "/stable_cme_r2/"
configuration_connection:
enable_replication: true
url_of_remote_site: "http://localhost/stable_cme_r3/check_mk/"
url_of_remote_site: "http://localhost/stable_cme_r2/check_mk/"
basic_settings:
site_id: "stable_cme_r3"
site_id: "stable_cme_r2"
customer: "provider"
alias: "stable_cme remote site 3"
alias: "stable_cme remote site 2"
authentication:
username: "cmkadmin"
password: "{{ checkmk_var_automation_secret }}"
- site_id: "stable_cme_r4"
- site_id: "stable_cme_r3"
site_config:
status_connection:
connection:
socket_type: "tcp"
port: 6564
port: 6563
encrypted: true
host: "localhost"
verify: false
proxy:
use_livestatus_daemon: "with_proxy"
global_settings: false
tcp:
port: 6664
tcp:
port: 6663
only_from: []
tls: true
params:
Expand All @@ -108,19 +83,19 @@ test_sites:
connect_timeout: 2
status_host:
status_host_set: "disabled"
url_prefix: "/stable_cme_r4/"
url_prefix: "/stable_cme_r3/"
configuration_connection:
enable_replication: true
url_of_remote_site: "http://localhost/stable_cme_r4/check_mk/"
url_of_remote_site: "http://localhost/stable_cme_r3/check_mk/"
disable_remote_configuration: true
ignore_tls_errors: false
direct_login_to_web_gui_allowed: false
replicate_event_console: true
replicate_extensions: false
basic_settings:
site_id: "stable_cme_r4"
site_id: "stable_cme_r3"
customer: "provider"
alias: "stable_cme remote site 4"
alias: "stable_cme remote site 3"
authentication:
username: "cmkadmin"
password: "{{ checkmk_var_automation_secret }}"
Expand Down Expand Up @@ -156,80 +131,7 @@ test_sites:
edition: "cre"
site: "stable_cre"
remote_sites:
#- site_id: "stable_cre_r1"
# site_config:
# status_connection:
# connection:
# socket_type: "tcp"
# port: 6561
# encrypted: false
# host: "localhost"
# verify: false
# proxy:
# use_livestatus_daemon: "direct"
# connect_timeout: 2
# status_host:
# status_host_set: "disabled"
# url_prefix: "/stable_cre_r1/"
# configuration_connection:
# enable_replication: false
# url_of_remote_site: "http://localhost/stable_cre_r1/check_mk/"
# basic_settings:
# site_id: "stable_cre_r1"
# alias: "stable_cre remote site 1"
# authentication:
# username: "cmkadmin"
# password: "{{ checkmk_var_automation_secret }}"
#- site_id: "stable_cre_r2"
# site_config:
# status_connection:
# connection:
# socket_type: "tcp"
# port: 6562
# encrypted: true
# host: "localhost"
# verify: false
# proxy:
# use_livestatus_daemon: "direct"
# connect_timeout: 2
# status_host:
# status_host_set: "disabled"
# url_prefix: "/stable_cre_r2/"
# configuration_connection:
# enable_replication: true
# url_of_remote_site: "http://localhost/stable_cre_r2/check_mk/"
# basic_settings:
# site_id: "stable_cre_r2"
# alias: "stable_cre remote site 2"
# authentication:
# username: "cmkadmin"
# password: "{{ checkmk_var_automation_secret }}"
#- site_id: "stable_cre_r3"
# site_config:
# status_connection:
# connection:
# socket_type: "tcp"
# port: 6563
# encrypted: true
# host: "localhost"
# verify: false
# proxy:
# use_livestatus_daemon: "with_proxy"
# global_settings: true
# connect_timeout: 2
# status_host:
# status_host_set: "disabled"
# url_prefix: "/stable_cre_r3/"
# configuration_connection:
# enable_replication: true
# url_of_remote_site: "http://localhost/stable_cre_r3/check_mk/"
# basic_settings:
# site_id: "stable_cre_r3"
# alias: "stable_cre remote site 3"
# authentication:
# username: "cmkadmin"
# password: "{{ checkmk_var_automation_secret }}"
- site_id: "stable_cre_r4"
- site_id: "stable_cre_r1"
site_config:
status_connection:
connection:
Expand All @@ -241,7 +143,7 @@ test_sites:
proxy:
use_livestatus_daemon: "with_proxy"
global_settings: false
tcp:
tcp:
port: 6664
only_from: []
tls: true
Expand All @@ -257,45 +159,21 @@ test_sites:
connect_timeout: 2
status_host:
status_host_set: "disabled"
url_prefix: "/stable_cre_r4/"
url_prefix: "/stable_cre_r1/"
configuration_connection:
enable_replication: true
url_of_remote_site: "http://localhost/stable_cre_r4/check_mk/"
url_of_remote_site: "http://localhost/stable_cre_r1/check_mk/"
disable_remote_configuration: true
ignore_tls_errors: false
direct_login_to_web_gui_allowed: false
replicate_event_console: true
replicate_extensions: false
basic_settings:
site_id: "stable_cre_r4"
alias: "stable_cre remote site 4"
site_id: "stable_cre_r1"
alias: "stable_cre remote site 1"
authentication:
username: "cmkadmin"
password: "{{ checkmk_var_automation_secret }}"
#- site_id: "stable_cre_r"
# site_config:
# status_connection:
# connection:
# socket_type: "tcp"
# port: 6559
# encrypted: true
# host: "localhost"
# verify: "true"
# proxy:
# use_livestatus_daemon: "direct"
# connect_timeout: 2
# status_host:
# status_host_set: "disabled"
# url_prefix: "/stable_cre_r/"
# configuration_connection:
# enable_replication: true
# url_of_remote_site: "http://localhost/stable_cre_r/check_mk/"
# basic_settings:
# site_id: "stable_cre_r"
# alias: "stable_cre remote site"
# authentication:
# username: "cmkadmin"
# password: "{{ checkmk_var_automation_secret }}"
- version: "2.2.0p32"
edition: "cre"
site: "old_cre"
Expand Down

0 comments on commit fd6ed64

Please sign in to comment.