aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/molecule/default/tests
diff options
context:
space:
mode:
authorColin Wilk <colin.wilk@tum.de>2023-10-11 15:34:10 +0200
committerColin Wilk <colin.wilk@tum.de>2023-10-11 15:49:45 +0200
commitc9c812343831be1bb56965b2aeff41eecdae0a11 (patch)
tree4a5eec53821831cfc746788f631e8b283bfebe3b /molecule/default/tests
parent6da60ee68e98d97f2c58ea7dca39d85c9b81370b (diff)
downloadansible-role-prometheus-target-c9c812343831be1bb56965b2aeff41eecdae0a11.tar.gz
ansible-role-prometheus-target-c9c812343831be1bb56965b2aeff41eecdae0a11.zip
Add run_once option for handlers
This adds the run_once option for the two handler types (shell and command). The variables `prometheus_target_handler_command_run_once` and `prometheus_target_handler_shell_run_once` are introduced to control this behavior. For this change a switch from the Ansible Handlers to regular tasks was necessary to enforce run_once behavior with delegated hosts. If you don't rely on handler specific features such as deferring, nothing changes when using the role. Signed-off-by: Colin Wilk <colin.wilk@tum.de>
Diffstat (limited to 'molecule/default/tests')
-rw-r--r--molecule/default/tests/test_check_prometheus_targets.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/molecule/default/tests/test_check_prometheus_targets.py b/molecule/default/tests/test_check_prometheus_targets.py
index ddf3a22..2eeb21b 100644
--- a/molecule/default/tests/test_check_prometheus_targets.py
+++ b/molecule/default/tests/test_check_prometheus_targets.py
@@ -58,12 +58,20 @@ def test_check_hosts_added_hooks(host):
t2 = host.file('/opt/hook1')
t3 = host.file('/opt/hook2')
- assert t1.content_string == \
- ' - application\n'
-
+ 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\n' \
+ 'hello\n'
"""
Test lineinfile strategy parameters