diff options
| author | Colin Wilk <colin@wilk.cx> | 2026-07-21 18:59:45 +0200 |
|---|---|---|
| committer | Colin Wilk <colin@wilk.cx> | 2026-07-21 18:59:45 +0200 |
| commit | 2287658a7c9aa0c8755d611c1552fb66d96eaa47 (patch) | |
| tree | 05faaad38a7d4c7798853265d476eba2eb55310f /molecule/default/tests/test_check_prometheus_targets.py | |
| parent | c88beb44f60e7c66a77b69e3c5f5edec163c1a56 (diff) | |
| download | ansible-role-prometheus-target-2287658a7c9aa0c8755d611c1552fb66d96eaa47.tar.gz ansible-role-prometheus-target-2287658a7c9aa0c8755d611c1552fb66d96eaa47.zip | |
test: split tests by strategy
Diffstat (limited to 'molecule/default/tests/test_check_prometheus_targets.py')
| -rw-r--r-- | molecule/default/tests/test_check_prometheus_targets.py | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/molecule/default/tests/test_check_prometheus_targets.py b/molecule/default/tests/test_check_prometheus_targets.py deleted file mode 100644 index b9024b4..0000000 --- a/molecule/default/tests/test_check_prometheus_targets.py +++ /dev/null @@ -1,90 +0,0 @@ -testinfra_hosts = ["prometheus"] - -""" -Test functionality of defining exporters and default fallbacks -""" - - -def test_check_hosts_added_simple(host): - t1 = host.file("/opt/simple_target1.yml") - t2 = host.file("/opt/simple_target2.yml") - t3 = host.file("/opt/simple_target3.yml") - t4 = host.file("/opt/simple_target4.yml") - - assert t1.exists - assert t2.exists - assert t3.exists - assert t4.exists - - assert t1.content_string == " - application\n" - - assert t2.content_string == " - test1\n - test2\n" - - assert t3.content_string == " - application_AA\n" - - assert t4.content_string == " - exporter_without_id\n" - - -""" -Test prefix functionality -""" - - -def test_check_hosts_added_prefix(host): - t1 = host.file("/opt/prefix_target1.yml") - t2 = host.file("/opt/prefix_target2.yml") - t3 = host.file("/opt/prefix/prefix_target3.yml") - - assert t1.exists - assert t2.exists - assert t3.exists - - assert t1.content_string == " - application\n" - - assert t2.content_string == " - application\n" - - assert t3.content_string == " - application\n" - - -""" -Test hook functionality -""" - - -def test_check_hosts_added_hooks(host): - t1 = host.file("/opt/hook_target.yml") - t2 = host.file("/opt/hook1") - t3 = host.file("/opt/hook2") - - assert t1.exists - assert t2.exists - assert t3.exists - - assert ( - t1.content_string == " - application\n - application2\n" - or t1.content_string == " - application2\n - application\n" - ) - - assert t3.content_string == "hello\nhello\n" - - -""" -Test lineinfile strategy parameters -""" - - -def test_check_host_added_lineinfile(host): - t1 = host.file("/opt/lineinfile.yml") - - assert t1.user == "prometheus" - assert t1.group == "prometheus" - assert t1.mode == 0o600 - - assert ( - t1.content_string == "- labels:\n" - " my: label\n" - " targets:\n" - " - existing:9100\n" - " - application:9100\n" - ) - |