aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/molecule/default/prepare.yml
diff options
context:
space:
mode:
authorColin Wilk <colin@wilk.cx>2026-07-21 19:58:10 +0200
committerColin Wilk <colin@wilk.cx>2026-07-21 19:58:10 +0200
commitc33948c219032977779a7ef6d82c16e84f37b81a (patch)
treef5a897d933639cdf97da2564d976610259115159 /molecule/default/prepare.yml
parent0055971afd5524f0df00fc8d2203a80f828885f7 (diff)
downloadansible-role-prometheus-target-c33948c219032977779a7ef6d82c16e84f37b81a.tar.gz
ansible-role-prometheus-target-c33948c219032977779a7ef6d82c16e84f37b81a.zip
test: expand Molecule coverage for exporter behavior
Cover lineinfile and YAML behavior for default exporters, skipped defaults, exporters without IDs, duplicate definitions, path and host overrides, path-prefix precedence, and inherited label overrides. Verify YAML handling of null documents, multiple files, labeled and unlabeled groups, and duplicate targets. Add test coverage for command and shell handlers using run-once, per-host, disabled, and non-become configurations.
Diffstat (limited to 'molecule/default/prepare.yml')
-rw-r--r--molecule/default/prepare.yml55
1 files changed, 55 insertions, 0 deletions
diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml
new file mode 100644
index 0000000..70764e7
--- /dev/null
+++ b/molecule/default/prepare.yml
@@ -0,0 +1,55 @@
+---
+- name: Prepare Prometheus target fixtures
+ hosts: prometheus
+ gather_facts: false
+ become: true
+
+ tasks:
+ - name: Create Prometheus test user
+ ansible.builtin.user:
+ name: prometheus
+
+ - name: Reset fixtures that exercise parallel writes
+ ansible.builtin.copy:
+ dest: "{{ item }}"
+ mode: "0644"
+ content: |
+ - labels:
+ job: node
+ targets:
+ - existing:9100
+ loop:
+ - /opt/yaml_parallel.yml
+ - /opt/yaml_parallel_second.yml
+
+ # These are intentionally not consumed yet. They provide stable starting
+ # states for the planned exporter state/removal coverage in both strategies.
+ - name: Prepare future YAML removal fixture
+ ansible.builtin.copy:
+ dest: /opt/yaml_state_removal.yml
+ mode: "0644"
+ content: |
+ - labels:
+ job: shared
+ targets:
+ - keep:9100
+ - remove:9100
+ - labels:
+ job: remove_last
+ targets:
+ - remove:9200
+
+ - name: Prepare future lineinfile removal fixture
+ ansible.builtin.copy:
+ dest: /opt/lineinfile_state_removal.yml
+ mode: "0644"
+ content: |
+ - labels:
+ job: shared
+ targets:
+ - keep:9100
+ - remove:9100
+ - labels:
+ job: remove_last
+ targets:
+ - remove:9200