From 579b168b2c93daee67ede17ee3289da1678b3833 Mon Sep 17 00:00:00 2001 From: Colin Wilk Date: Thu, 15 Jun 2023 22:40:27 +0200 Subject: Add ability to use exporter without id property The id property of the exporter is used for checking the default values specified in `prometheus_target_exporter_defaults` variable. However when both the `host` and the `path` fields are specified manually in the `prometheus_target_exporter` list this id is never looked up. The way the templating was handled however, still resulted in an error when leaving out the id field. The templating code was now rewritten to allow for the following exporter configuraion to run: prometheus_target_exporter: - { host: exporter_without_id, path: /opt/simple_target4.yml } Signed-off-by: Colin Wilk --- molecule/default/tests/test_check_prometheus_targets.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'molecule/default/tests/test_check_prometheus_targets.py') diff --git a/molecule/default/tests/test_check_prometheus_targets.py b/molecule/default/tests/test_check_prometheus_targets.py index 9ce1056..ddf3a22 100644 --- a/molecule/default/tests/test_check_prometheus_targets.py +++ b/molecule/default/tests/test_check_prometheus_targets.py @@ -7,10 +7,12 @@ 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' @@ -23,6 +25,9 @@ def test_check_hosts_added_simple(host): assert t3.content_string == \ ' - application_AA\n' + assert t4.content_string == \ + ' - exporter_without_id\n' + """ Test prefix functionality """ -- cgit v1.2.3