Skip to content

Commit

Permalink
Add test for scrape config files
Browse files Browse the repository at this point in the history
Signed-off-by: Leonhard Mayr <[email protected]>
  • Loading branch information
manzsolutions-lpr committed Jun 10, 2024
1 parent e428173 commit c1920cc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions roles/prometheus/molecule/alternative/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ provisioner:
- influx.example.org:8080
labels:
env: demo
prometheus_scrape_config_files:
- /tmp/prometheus/scrapes/*.yml
prometheus_scrape_configs:
- job_name: "prometheus"
metrics_path: "{{ prometheus_metrics_path }}"
Expand Down
10 changes: 10 additions & 0 deletions roles/prometheus/molecule/alternative/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@
dest: "/tmp/prometheus-linux-amd64"
state: link
check_mode: false

- name: Create scrapes directory
ansible.builtin.file:
name: /tmp/prometheus/scrapes
state: directory
recurse: true
- name: Create empty scrape config file

Check failure on line 40 in roles/prometheus/molecule/alternative/prepare.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

risky-file-permissions

File permissions unset or incorrect.
ansible.builtin.file:
name: /tmp/prometheus/scrapes/empty_scrapes.yml
state: touch
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"/opt/prom/etc",
"/opt/prom/etc/rules",
"/opt/prom/etc/file_sd",
"/opt/prom/etc/scrapes",
"/opt/prom/lib"
])
def test_directories(host, dirs):
Expand All @@ -26,6 +27,7 @@ def test_directories(host, dirs):
"/opt/prom/etc/rules/ansible_managed.rules",
"/opt/prom/etc/file_sd/node.yml",
"/opt/prom/etc/file_sd/docker.yml",
"/opt/prom/etc/scrapes/empty_scrapes.yml",
"/usr/local/bin/prometheus",
"/usr/local/bin/promtool"
])
Expand Down

0 comments on commit c1920cc

Please sign in to comment.