Skip to content

Commit

Permalink
Merge branch 'master' into disable_observability_strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiesmelfie authored Oct 29, 2024
2 parents 089b043 + 65b8296 commit 19b80c3
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ci/logging_tests_computes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
- ceilometer_agent_compute
- nova_compute
tasks:
- name: "Verify journalctl logging identifiers"
- name: "Run Telemetry Logging tests"
ansible.builtin.import_role:
name: telemetry_logging
18 changes: 18 additions & 0 deletions ci/logging_tests_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,21 @@
ansible.builtin.import_role:
name: common

- name: "Verify the crds exist"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_crd_test_id: "RHOSO-12670"
common_crd_list:
- alertingrules.loki.grafana.com
- lokistacks.loki.grafana.com
- recordingrules.loki.grafana.com
- rulerconfigs.loki.grafana.com
tasks:
- name: "Run the crds tests"
ansible.builtin.import_role:
name: common
39 changes: 33 additions & 6 deletions roles/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ For pod_tests.yml tasks:
common_pod_nspace
- list of projects where pods exist

For crd_tests.yml tasks:

common_crd_test_id
- polarion ID number for each test.
common_crd_list
- list of crd to validate



For project_tests.yml tasks:

Expand Down Expand Up @@ -71,16 +79,26 @@ can be set at the play level.
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12752"
common_pod_status_str: "Running"
common_pod_nspace: openstack
common_pod_list:
- openstackclient
tasks:
- name: "Verify Running Pods"
ansible.builtin.import_role:
name: common
vars:
common_pod_test_id: "RHOSO-12752"
common_pod_status_str: "Running"
common_pod_nspace: openstack
common_pod_list:
- openstackclient

- name: "Verify status of multiple containers"
ansible.builtin.include_role:
name: common
vars:
common_container_test_id: "RHOSO-12753"
common_container_list:
- ceilometer_agent_compute
- ceilometer_agent_ipmi
- node_exporter

- name: "Verify projects"
ansible.builtin.import_role:
Expand All @@ -91,6 +109,15 @@ can be set at the play level.
- openshift-openstack-infra
- openshift

- name: "Verify crd"
ansible.builtin.import_role:
name: common
vars:
common_crd_test_id : "crd_test_id"
common_crd_list:
- list of crd to validate


License
-------

Expand Down
15 changes: 15 additions & 0 deletions roles/common/tasks/container_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Get container status
ansible.builtin.shell:
cmd: |
podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep {{ item }}
changed_when: false
register: container_status


- name: Verify container status {{ common_container_test_id }}
ansible.builtin.assert:
that:
- "'Up' in container_status.stdout"
success_msg: "Container '{{ item }}' is in 'Up' status."
fail_msg: "Container '{{ item }}' is not in 'Up' status. Current status: {{ container_status.stdout }}"
14 changes: 14 additions & 0 deletions roles/common/tasks/crd_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- name: Verify CRD "{{ item }}"
ansible.builtin.shell:
cmd: |
oc get crd "{{ item }}"
changed_when: false
register: output

- name: Verify CRD is found "{{ common_crd_test_id }}"
ansible.builtin.assert:
that:
- "'NotFound' not in output.stderr"
success_msg: "CRD {{ item }} is found."
fail_msg: "CRD {{ item }} not found. Error: {{ output.stderr }}"
24 changes: 20 additions & 4 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- name: "Run pod tests"
- name: "Verify pod - {{ common_pod_test_id }}"
when:
- common_pod_test_id is defined
- common_pod_list is defined
- common_pod_nspace is defined
- common_pod_status_str is defined
Expand All @@ -9,14 +10,29 @@

- name: "Run project tests"
when:
- common_project_test_id is defined
- common_project_list is defined
ansible.builtin.include_tasks: "project_tests.yml"
loop: "{{ common_project_list }}"

- name: "Run manifest tests"
when:
- manifest_test_id is defined
- manifest_list is defined
- common_manifest_test_id is defined
- common_manifest_list is defined
ansible.builtin.include_tasks: "manifest_tests.yml"
loop: "{{ manifest_list }}"
loop: "{{ common_manifest_list }}"

- name: "Run crd tests"
when:
- common_crd_test_id is defined
- common_crd_list is defined
ansible.builtin.include_tasks: "crd_tests.yml"
loop: "{{ common_crd_list }}"

- name: "Verify container tests"
when:
- common_container_list is defined
- common_container_test_id is defined
ansible.builtin.include_tasks: "container_test.yml"
loop: "{{ common_container_list }}"

2 changes: 1 addition & 1 deletion roles/common/tasks/manifest_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
register: pack_name
changed_when: false

- name: Get packagemanifest "{{ manifest_test_id }}"
- name: Get packagemanifest "{{ common_manifest_test_id }}"
ansible.builtin.shell:
cmd: |
oc get packagemanifests | grep "{{ pack_name.stdout }}" | wc -l
Expand Down
2 changes: 1 addition & 1 deletion roles/common/tasks/pod_tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- block:
# expects that one line will be returned
# todo: define what hapens when there are multiple pods returned
# todo: define what happens when there are multiple pods returned
- name: Get Pod Instance name "{{ common_pod_status_str }}"
ansible.builtin.shell:
cmd: |
Expand Down

0 comments on commit 19b80c3

Please sign in to comment.