Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update snmp functional tests #212

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions roles/test_snmp_traps/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ansible.builtin.shell:
cmd: |
oc patch stf/default --type merge -p '{"spec": {"alerting": {"alertmanager": {"receivers": {"snmpTraps": {"enabled": true, "target": "10.10.10.10" }}}}}}'
changed_when: false
changed_when: 'cmd_output == "servicetelemetry.infra.watch/default patched"'
register: cmd_output
failed_when: cmd_output.rc != 0

Expand Down Expand Up @@ -69,17 +69,18 @@
- name: "RHELOSP-144481 Check for snmpTraps logs"
ansible.builtin.shell:
cmd: |
oc logs -l "app=default-snmp-webhook" | grep "Sending SNMP trap"
oc logs -l "app=default-snmp-webhook"
register: cmd_output
changed_when: false
failed_when: "cmd_output.stdout_lines | length == 0"
retries: 12
delay: 10
until: "'Sending SNMP trap' in cmd_output.stdout"


rescue:
- name: "Get the snmp traps logs"
ansible.builtin.shell:
cmd: |
oc logs -l "app=default-snmp-webhook"
changed_when: false
- name: "Show the snmp traps logs"
ansible.builtin.debug:
var: cmd_output.stdout

always:
- name: "Delete the PrometheusRule"
Expand All @@ -98,6 +99,14 @@
until: 'not "FVT_TESTING Collectd metrics receive rate is zero" in cmd_output.stdout'
changed_when: false

- name: "Remove alertmanagerConfigManifest from the ServiceTelemetry object"
ansible.builtin.shell:
cmd: |
oc patch stf/default --type='json' -p '[{"op": "replace", "path": "/spec/alerting/alertmanager/receivers/snmpTraps/enabled", "value": false }]'
changed_when: 'cmd_output == "servicetelemetry.infra.watch/default patched"'
register: cmd_output
failed_when: cmd_output.rc != 0

- name: "Wait up to 2 minutes to make sure all default-interconnect pods are back"
ansible.builtin.command:
cmd: |
Expand Down