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

Add service and file tests to the logging job #200

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions ci/logging_tests_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@
- openshift
- openstack-operators
- openshift-logging
common_service_test_id: "RHOSO-12675"
common_service_nspace: openshift-logging
common_service_list:
- cluster-logging-operator-metrics
- logging-loki-compactor-grpc
- logging-loki-compactor-http
- logging-loki-distributor-grpc
- logging-loki-distributor-http
- logging-loki-gateway-http
- logging-loki-gossip-ring
- logging-loki-index-gateway-grpc
- logging-loki-index-gateway-http
- logging-loki-ingester-grpc
- logging-loki-ingester-http
- logging-loki-querier-grpc
- logging-loki-querier-http
- logging-loki-query-frontend-grpc
- logging-loki-query-frontend-http
- logging-view-plugin
- openstack-logging
common_file_test_id: "RHOSO-12754"
common_file_list:
- /etc/rsyslog.d/10-telemetry.conf
tasks:
- name: "Verify logging infrastructure components"
ansible.builtin.import_role:
Expand Down
49 changes: 48 additions & 1 deletion roles/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ For project_tests.yml tasks:
common_project_list
- list of projects to validate

For service_tests.yml tasks:

common_service_test_id
- polarion ID number for each test
common_service_nspace
- namespace
common_service_list
- list of services to validate

For file_tests.yml tasks:

common_file_test_id
- polarion ID number for each test
common_file_list
- list of files to validate

For manifest_tests.yml tasks:

Expand Down Expand Up @@ -159,7 +174,39 @@ can be set at the play level.
common_project_list:
- openshift-openstack-infra
- openshift


- name: "Verify services"
ansible.builtin.import_role:
name: common
vars:
common_service_test_id: "RHOSO-12675"
common_service_nspace: openshift-logging
common_service_list:
- cluster-logging-operator-metrics
- logging-loki-compactor-grpc
- logging-loki-compactor-http
- logging-loki-distributor-grpc
- logging-loki-distributor-http
- logging-loki-gateway-http
- logging-loki-gossip-ring
- logging-loki-index-gateway-grpc
- logging-loki-index-gateway-http
- logging-loki-ingester-grpc
- logging-loki-ingester-http
- logging-loki-querier-grpc
- logging-loki-querier-http
- logging-loki-query-frontend-grpc
- logging-loki-query-frontend-http
- logging-view-plugin
- openstack-logging

- name: "Verify files"
ansible.builtin.import_role:
name: common
vars:
common_file_test_id: "RHOSO-12754"
common_file_list:
- /etc/rsyslog.d/10-telemetry.conf

- name: "Verify crd"
ansible.builtin.import_role:
Expand Down
10 changes: 10 additions & 0 deletions roles/common/tasks/file_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Get stats for file - "{{ item }}"
ansible.builtin.stat:
path: "{{ item }}"
register: fstats
failed_when:
- fstats.stat.pw_name != "root"
- fstats.stat.size | int < 300
- not fstats.stat.exists
- not fstats.stat.isreg
15 changes: 15 additions & 0 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
- common_project_list is defined
ansible.builtin.include_tasks: "project_tests.yml"
loop: "{{ common_project_list }}"

- name: "Run service tests"
when:
- common_service_test_id is defined
- common_service_nspace is defined
- common_service_list is defined
ansible.builtin.include_tasks: "service_tests.yml"
loop: "{{ common_service_list }}"

- name: "Run file tests"
when:
- common_file_test_id is defined
- common_file_list is defined
ansible.builtin.include_tasks: "file_tests.yml"
loop: "{{ common_file_list }}"

- name: "Run manifest tests"
when:
Expand Down
16 changes: 16 additions & 0 deletions roles/common/tasks/service_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- name: Verify Service - "{{ item }}"
ansible.builtin.shell:
cmd: |
oc get service -n "{{ common_service_nspace }}" "{{ item }}"
changed_when: false
register: output

- name: |
Verify {{ item }} service is running
{{ common_service_test_id }}
ansible.builtin.assert:
that:
- "'NotFound' not in output.stderr"
success_msg: "service {{ item }} is running."
fail_msg: "service {{ item }} not running. Error: {{ output.stderr }}"
Loading