Skip to content

Commit

Permalink
[test_verify_email] Clean up the PrometheusRule post-test (#196)
Browse files Browse the repository at this point in the history
Delete the PrometheusRule and wait for it to be deleted
  • Loading branch information
elfiesmelfie authored Dec 10, 2024
1 parent 0a05201 commit 2d9d907
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions roles/test_verify_email/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
---
# tasks file for roles/test_verify_email

- name: "Set the prom auth"
ansible.builtin.include_role:
name: client_side_tests
tasks_from: get_prom_info.yml
vars:
prom_auth_method: token
when:
- prom_auth_string is not defined
- prom_url is not defined

- name: "Get the observability strategy and set observability_api"
ansible.builtin.include_role:
name: test_alerts
Expand All @@ -18,13 +29,13 @@
labels:
prometheus: default
role: alert-rules
name: prometheus-alarm-rules
name: fvt-testing-prometheus-alarm-rules-email
namespace: service-telemetry
spec:
groups:
- name: ./openstack.rules
rules:
- alert: Collectd metrics receive rate is zero
- alert: FVT_TESTING Collectd metrics receive rate is zero
expr: rate(sg_total_collectd_msg_received_count[1m]) == 0
EOF
changed_when: false
Expand Down Expand Up @@ -54,6 +65,21 @@
changed_when: false

always:
- name: "Delete the PrometheusRule"
ansible.builtin.command: |
oc delete prometheusrule.{{ observability_api }} fvt-testing-prometheus-alarm-rules-email
register: delete_prom
changed_when: delete_prom.rc == 0

- name: "Wait up to two minutes until the rule is deleted"
ansible.builtin.command:
cmd: |
curl -k {{ prom_auth_string }} https://{{ prom_url }}/api/v1/rules
retries: 12
delay: 10
until: 'not "FVT_TESTING Collectd metrics receive rate is zero" in cmd_output.stdout'
changed_when: false

- name: "RHELOSP-176046 Remove alertmanagerConfigManifest from the ServiceTelemetry object"
ansible.builtin.shell:
cmd: |
Expand Down

0 comments on commit 2d9d907

Please sign in to comment.