Skip to content

Commit 143e6d6

Browse files
authored
Merge branch 'master' into mgirgis-network-db
2 parents 4167268 + 54657ee commit 143e6d6

File tree

12 files changed

+432
-181
lines changed

12 files changed

+432
-181
lines changed

callback_plugins/custom_logger.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def log_summary_results(self, host):
8585
print("The host %s does not have any results" % host)
8686
return
8787

88-
with open(file_path, 'w') as f:
88+
with open(file_path, 'a') as f:
8989
f.write(f"Host: {host}\n")
9090
f.write(f"Tasks Succeeded: {self.results[host]['passed']}\n")
9191
f.write(f"Tasks Failed: {self.results[host]['failed']}\n")

ci/logging_tests_controller.yml

+23
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,29 @@
2323
- openshift
2424
- openstack-operators
2525
- openshift-logging
26+
common_service_test_id: "RHOSO-12675"
27+
common_service_nspace: openshift-logging
28+
common_service_list:
29+
- cluster-logging-operator-metrics
30+
- logging-loki-compactor-grpc
31+
- logging-loki-compactor-http
32+
- logging-loki-distributor-grpc
33+
- logging-loki-distributor-http
34+
- logging-loki-gateway-http
35+
- logging-loki-gossip-ring
36+
- logging-loki-index-gateway-grpc
37+
- logging-loki-index-gateway-http
38+
- logging-loki-ingester-grpc
39+
- logging-loki-ingester-http
40+
- logging-loki-querier-grpc
41+
- logging-loki-querier-http
42+
- logging-loki-query-frontend-grpc
43+
- logging-loki-query-frontend-http
44+
- logging-view-plugin
45+
- openstack-logging
46+
common_file_test_id: "RHOSO-12754"
47+
common_file_list:
48+
- /etc/rsyslog.d/10-telemetry.conf
2649
tasks:
2750
- name: "Verify logging infrastructure components"
2851
ansible.builtin.import_role:

roles/common/README.md

+48-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@ For project_tests.yml tasks:
6767
common_project_list
6868
- list of projects to validate
6969

70+
For service_tests.yml tasks:
71+
72+
common_service_test_id
73+
- polarion ID number for each test
74+
common_service_nspace
75+
- namespace
76+
common_service_list
77+
- list of services to validate
78+
79+
For file_tests.yml tasks:
80+
81+
common_file_test_id
82+
- polarion ID number for each test
83+
common_file_list
84+
- list of files to validate
7085

7186
For manifest_tests.yml tasks:
7287

@@ -159,7 +174,39 @@ can be set at the play level.
159174
common_project_list:
160175
- openshift-openstack-infra
161176
- openshift
162-
177+
178+
- name: "Verify services"
179+
ansible.builtin.import_role:
180+
name: common
181+
vars:
182+
common_service_test_id: "RHOSO-12675"
183+
common_service_nspace: openshift-logging
184+
common_service_list:
185+
- cluster-logging-operator-metrics
186+
- logging-loki-compactor-grpc
187+
- logging-loki-compactor-http
188+
- logging-loki-distributor-grpc
189+
- logging-loki-distributor-http
190+
- logging-loki-gateway-http
191+
- logging-loki-gossip-ring
192+
- logging-loki-index-gateway-grpc
193+
- logging-loki-index-gateway-http
194+
- logging-loki-ingester-grpc
195+
- logging-loki-ingester-http
196+
- logging-loki-querier-grpc
197+
- logging-loki-querier-http
198+
- logging-loki-query-frontend-grpc
199+
- logging-loki-query-frontend-http
200+
- logging-view-plugin
201+
- openstack-logging
202+
203+
- name: "Verify files"
204+
ansible.builtin.import_role:
205+
name: common
206+
vars:
207+
common_file_test_id: "RHOSO-12754"
208+
common_file_list:
209+
- /etc/rsyslog.d/10-telemetry.conf
163210

164211
- name: "Verify crd"
165212
ansible.builtin.import_role:

roles/common/tasks/file_tests.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
- name: Get stats for file - "{{ item }}"
3+
ansible.builtin.stat:
4+
path: "{{ item }}"
5+
register: fstats
6+
failed_when:
7+
- fstats.stat.pw_name != "root"
8+
- fstats.stat.size | int < 300
9+
- not fstats.stat.exists
10+
- not fstats.stat.isreg

roles/common/tasks/main.yml

+15
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@
2727
- common_project_list is defined
2828
ansible.builtin.include_tasks: "project_tests.yml"
2929
loop: "{{ common_project_list }}"
30+
31+
- name: "Run service tests"
32+
when:
33+
- common_service_test_id is defined
34+
- common_service_nspace is defined
35+
- common_service_list is defined
36+
ansible.builtin.include_tasks: "service_tests.yml"
37+
loop: "{{ common_service_list }}"
38+
39+
- name: "Run file tests"
40+
when:
41+
- common_file_test_id is defined
42+
- common_file_list is defined
43+
ansible.builtin.include_tasks: "file_tests.yml"
44+
loop: "{{ common_file_list }}"
3045

3146
- name: "Run manifest tests"
3247
when:

roles/common/tasks/service_tests.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- name: Verify Service - "{{ item }}"
3+
ansible.builtin.shell:
4+
cmd: |
5+
oc get service -n "{{ common_service_nspace }}" "{{ item }}"
6+
changed_when: false
7+
register: output
8+
9+
- name: |
10+
Verify {{ item }} service is running
11+
{{ common_service_test_id }}
12+
ansible.builtin.assert:
13+
that:
14+
- "'NotFound' not in output.stderr"
15+
success_msg: "service {{ item }} is running."
16+
fail_msg: "service {{ item }} not running. Error: {{ output.stderr }}"

roles/telemetry_graphing/tasks/cypress_test.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
- name: |
8686
TEST Check if all tests passed
8787
RHOSO-13628
88-
ansible.builtin.fail:
89-
msg: "Some Cypress tests failed."
90-
when: cypress_run.rc != 0
88+
ansible.builtin.assert:
89+
that:
90+
- cypress_run.rc == 0
91+
fail_msg: "Some Cypress tests failed."
92+
success_msg: "All Cypress tests passed successfully."

roles/test_alerts/tasks/test_create_an_alert.yml

+48-30
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,52 @@
33
# Assuming we're in the right project already...
44
# Following procedure on https://infrawatch.github.io/documentation/#creating-an-alert-rule-in-prometheus_assembly-advanced-features
55

6-
- name: "RHELOSP-144965 Create the alert"
7-
ansible.builtin.shell:
8-
cmd: |
9-
oc apply -f - <<EOF
10-
apiVersion: {{ observability_api }}/v1
11-
kind: PrometheusRule
12-
metadata:
13-
creationTimestamp: null
14-
labels:
15-
prometheus: default
16-
role: alert-rules
17-
name: prometheus-alarm-rules
18-
namespace: service-telemetry
19-
spec:
20-
groups:
21-
- name: ./openstack.rules
22-
rules:
23-
- alert: Collectd metrics receive rate is zero
24-
expr: rate(sg_total_collectd_msg_received_count[1m]) == 0
25-
EOF
26-
changed_when: false
27-
register: cmd_output
28-
failed_when: cmd_output.rc != 0
6+
- name: "Do the test procedure"
7+
block:
8+
- name: "RHELOSP-144965 Create the alert"
9+
ansible.builtin.shell:
10+
cmd: |
11+
oc apply -f - <<EOF
12+
apiVersion: {{ observability_api }}/v1
13+
kind: PrometheusRule
14+
metadata:
15+
creationTimestamp: null
16+
labels:
17+
prometheus: default
18+
role: alert-rules
19+
name: fvt-testing-prometheus-alarm-rules
20+
namespace: service-telemetry
21+
spec:
22+
groups:
23+
- name: ./openstack.rules
24+
rules:
25+
- alert: FVT_TESTING Collectd metrics receive rate is zero
26+
expr: rate(sg_total_collectd_msg_received_count[1m]) == 0
27+
EOF
28+
changed_when: false
29+
register: cmd_output
30+
failed_when: cmd_output.rc != 0
2931

30-
- name: "RHELOSP-144480 Check that the alert was created"
31-
ansible.builtin.command:
32-
cmd: |
33-
curl -k {{ prom_auth_string }} https://{{ prom_url }}/api/v1/rules
34-
register: cmd_output
35-
changed_when: false
36-
failed_when: cmd_output.rc != 0
32+
- name: "RHELOSP-144480 Check that the alert was created"
33+
ansible.builtin.command:
34+
cmd: |
35+
curl -k {{ prom_auth_string }} https://{{ prom_url }}/api/v1/rules
36+
register: cmd_output
37+
changed_when: true
38+
39+
always:
40+
- name: "Delete the PrometheusRule"
41+
ansible.builtin.command:
42+
cmd: |
43+
oc delete prometheusrule.{{ observability_api }} fvt-testing-prometheus-alarm-rules
44+
register: delete_prom
45+
changed_when: delete_prom.rc == 0
46+
47+
- name: Wait up to two minutes until the rule is deleted
48+
ansible.builtin.command:
49+
cmd: |
50+
curl -k {{ prom_auth_string }} https://{{ prom_url }}/api/v1/rules
51+
retries: 12
52+
delay: 10
53+
until: 'not "FVT_TESTING Collectd metrics receive rate is zero" in cmd_output.stdout'
54+
changed_when: false

0 commit comments

Comments
 (0)