Add playbook for prometheus alert tests

- Install prometheus snap
- Verify that the alert rules tests pass
Change-Id: I38883a431735546bae2033b6f34cc40644231a4c
This commit is contained in:
sudeephb
2023年09月14日 10:42:43 +05:45
parent 3a0ab0a87f
commit 92f6ac40f7

View File

@@ -0,0 +1,3 @@
- hosts:all
roles:
- prometheus-alert-rules-test

View File

@@ -0,0 +1,24 @@
- name:snapd is installed
apt:
name:snapd
become:true
- name:prometheus is installed
snap:
name:prometheus
channel:"{{ prometheus_channel | default('2/stable') }}"
become:true
- name:Check if prometheus_alerts_test_rules_dir exists
stat:
path:"{{ zuul.project.src_dir }}/{{ prometheus_alerts_test_rules_dir }}"
register:prometheus_alerts_dir_exists
- name:Exit if test rules dir doesn't exist
fail:
msg:"Directory {{ prometheus_alerts_test_rules_dir }} does not exist"
when:not prometheus_alerts_dir_exists.stat.exists
- name:promtool tests pass
command:
cmd:bash -c 'promtool test rules {{ zuul.project.src_dir }}/{{ prometheus_alerts_test_rules_dir }}/*.yaml'

View File

@@ -12,3 +12,8 @@
requires:charm
dependencies:
- name:charmbuild
- job:
name:prometheus-alert-rules-test
run:playbooks/prometheus-alert-rules-test.yaml
timeout:600

View File

@@ -9,3 +9,13 @@
nodeset:ubuntu-focal
- zaza-smoke-test:
nodeset:ubuntu-focal
- project-template:
name:prometheus-alert-rules-test
description:|
This project template is defined to run prometheus alert rules
tests
check:
jobs:
- prometheus-alert-rules-test:
nodeset:ubuntu-focal
Reference in New Issue
openstack/charm-zuul-jobs
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.