Skip to content
Open
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
202 changes: 136 additions & 66 deletions ci/logging_tests_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,29 +86,32 @@
common_pod_nspace: openstack
common_pod_list:
- openstackclient
- name: loki-operator-controller-manager
nspace: openshift-operators-redhat
test_id: "RHOSO-12673"
tasks:
- name: "Verify Running Pods"
ansible.builtin.import_role:
name: common


- name: "Verify logging pods are running in openshift-operators-redhat"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12673"
common_pod_status_str: "Running"
common_pod_nspace: openshift-operators-redhat
common_pod_list:
- loki-operator-controller-manager
tasks:
- name: "Verify Pods running"
ansible.builtin.import_role:
name: common
#- name: "Verify logging pods are running in openshift-operators-redhat"
# hosts: controller
# gather_facts: no
# ignore_errors: true
# environment:
# KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
# PATH: "{{ cifmw_path }}"
# vars:
# common_pod_test_id: "RHOSO-12673"
# common_pod_status_str: "Running"
# common_pod_nspace: openshift-operators-redhat
# common_pod_list:
# - loki-operator-controller-manager
# tasks:
# - name: "Verify Pods running"
# ansible.builtin.import_role:
# name: common

- name: "Verify logging pods are running in openshift-logging"
hosts: controller
Expand All @@ -131,64 +134,131 @@
- logging-loki-querier
- logging-loki-query-frontend
- collector
- name: minio
nspace: minio-dev
test_id: "RHOSO-12674"
- name: bootstrap-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: configure-network-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: configure-os-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: download-cache-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: install-certs-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: install-os-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: libvirt-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: logging-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: neutron-metadata-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: nova-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: ovn-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: reboot-os-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: run-os-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: ssh-known-hosts-edpm-deployment
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: telemetry-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"
- name: validate-network-edpm-deployment-openstack-edpm-ipam
nspace: openstack
status_str: "Completed"
test_id: "RHOSO-12679"

### see JIRA LOG-5431 if pods not running
tasks:
- name: "Verify Pods running"
ansible.builtin.import_role:
name: common

- name: "Verify logging pods are running in minio-dev"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12674"
common_pod_status_str: "Running"
common_pod_nspace: minio-dev
common_pod_list:
- minio
tasks:
- name: "Run pod running tests"
ansible.builtin.import_role:
name: common
#- name: "Verify logging pods are running in minio-dev"
# hosts: controller
# gather_facts: no
# ignore_errors: true
# environment:
# KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
# PATH: "{{ cifmw_path }}"
# vars:
# common_pod_test_id: "RHOSO-12674"
# common_pod_status_str: "Running"
# common_pod_nspace: minio-dev
# common_pod_list:
# - minio
# tasks:
# - name: "Run pod running tests"
# ansible.builtin.import_role:
# name: common


- name: "Verify logging pods have complete status in openstack"
hosts: controller
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12679"
common_pod_nspace: openstack
common_pod_status_str: "Completed"
common_pod_list:
- bootstrap-edpm-deployment-openstack-edpm-ipam
- configure-network-edpm-deployment-openstack-edpm-ipam
- configure-os-edpm-deployment-openstack-edpm-ipam
- download-cache-edpm-deployment-openstack-edpm-ipam
- install-certs-edpm-deployment-openstack-edpm-ipam
- install-os-edpm-deployment-openstack-edpm-ipam
- libvirt-edpm-deployment-openstack-edpm-ipam
- logging-edpm-deployment-openstack-edpm-ipam
- neutron-metadata-edpm-deployment-openstack-edpm-ipam
- nova-edpm-deployment-openstack-edpm-ipam
- ovn-edpm-deployment-openstack-edpm-ipam
- reboot-os-edpm-deployment-openstack-edpm-ipam
- run-os-edpm-deployment-openstack-edpm-ipam
- ssh-known-hosts-edpm-deployment
- telemetry-edpm-deployment-openstack-edpm-ipam
- validate-network-edpm-deployment-openstack-edpm-ipam
tasks:
- name: "Run pods completed tests"
ansible.builtin.import_role:
name: common
#- name: "Verify logging pods have complete status in openstack"
# hosts: controller
# gather_facts: no
# ignore_errors: true
# environment:
# KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
# PATH: "{{ cifmw_path }}"
# vars:
# common_pod_test_id: "RHOSO-12679"
# common_pod_nspace: openstack
# common_pod_status_str: "Completed"
# common_pod_list:
# - name: bootstrap-edpm-deployment-openstack-edpm-ipam
# - name: configure-network-edpm-deployment-openstack-edpm-ipam
# - name: configure-os-edpm-deployment-openstack-edpm-ipam
# - name: download-cache-edpm-deployment-openstack-edpm-ipam
# - name: install-certs-edpm-deployment-openstack-edpm-ipam
# - name: install-os-edpm-deployment-openstack-edpm-ipam
# - name: libvirt-edpm-deployment-openstack-edpm-ipam
# - name: logging-edpm-deployment-openstack-edpm-ipam
# - name: neutron-metadata-edpm-deployment-openstack-edpm-ipam
# - name: nova-edpm-deployment-openstack-edpm-ipam
# - name: ovn-edpm-deployment-openstack-edpm-ipam
# - name: reboot-os-edpm-deployment-openstack-edpm-ipam
# - name: run-os-edpm-deployment-openstack-edpm-ipam
# - name: ssh-known-hosts-edpm-deployment
# - name: telemetry-edpm-deployment-openstack-edpm-ipam
# - name: validate-network-edpm-deployment-openstack-edpm-ipam
# tasks:
# - name: "Run pods completed tests"
# ansible.builtin.import_role:
# name: common

- name: "Verify the crds exist"
hosts: controller
Expand Down
20 changes: 17 additions & 3 deletions roles/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,22 @@ Variable required for all tasks to run
For pod_tests.yml tasks:

common_pod_list
- list of pods to validate
(list) the list of pods to validate
Each list value can take one of two forms
- (string) the names of the pods to validate
- (dict) with name, nspace, status_str and (optionally) test_id elements.
When a list of strings is used, the other values (listed below) are required.
When the list of dicts is used, the types match the vars below

common_pod_test_id (optional)
- (string) polarion ID number for each test.
This is used as the default value for common_pod_list.test_id
common_pod_status_str
- status of pods to check
- (string) status of pods to check e.g. "Running", "Completed", etc
This is used as the default value for common_pod_list.status_str
common_pod_nspace
- list of projects where pods exist
- (string) The namespace where the pod should exist.
This is also used as default for the common_pod_list.nspace


For subscription_tests.yml tasks:
Expand Down Expand Up @@ -116,6 +127,9 @@ can be set at the play level.
common_pod_nspace: openstack
common_pod_list:
- openstackclient
- name: cluster-logging-operator
nspace: openshift-logging
# the status_str and test_id will default to the common_pod_* vars

- name: "Verify subscription"
ansible.builtin.import_role:
Expand Down
24 changes: 18 additions & 6 deletions roles/common/tasks/pod_tests.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
---
- name: Convert the pod info into a dict
ansible.builtin.set_fact:
pod:
name: "{{ item.name if \"name\" in item else item }}"
nspace: "{{ item.nspace if \"nspace\" in item else common_pod_nspace }}"
status_str: "{{ item.status_str if \"status_str\" in item else common_pod_status_str }}"
test_id: "{{ item.test_id if \"test_id\" in item else common_pod_test_id | default(omit) }}"

- name: Show the pod details for this test
ansible.builtin.debug:
var: pod

- block:
# expects that one line will be returned
# todo: define what happens when there are multiple pods returned
- name: Get Pod Instance name "{{ common_pod_status_str }}"
- name: Get Pod Instance name "{{ pod.status_str }}"
ansible.builtin.shell:
cmd: |
oc get pods -n "{{ common_pod_nspace }}" | grep "{{ item }}" | grep "{{ common_pod_status_str }}" | awk '{print $1;}'
oc get pods -n "{{ pod.nspace }}" | grep "{{ pod.name }}" | grep "{{ pod.status_str }}" | awk '{print $1;}'
register: podinstance
failed_when:
- podinstance.stdout_lines | length != 1
changed_when: false

- name: |
TEST Check {{ item }} pod is {{ common_pod_status_str }} in {{ common_pod_nspace }} namespace
TEST Check {{ pod.name }} pod is {{ pod.status_str }} in {{ pod.nspace }} namespace
ansible.builtin.command:
cmd: |
oc get pod -n "{{ common_pod_nspace }}" "{{ podinstance.stdout }}"
oc get pod -n "{{ pod.nspace }}" "{{ podinstance.stdout }}"
register: output
changed_when: false
failed_when:
- output.rc != 0
- podinstance.stdout == ""
rescue:
- name: Get Pod Instance "{{ item }}"
- name: Get Pod Instance "{{ pod.name }}"
ansible.builtin.shell:
cmd: |
oc get pods -n "{{ common_pod_nspace }}" | grep "{{ item }}"
oc get pods -n "{{ pod.nspace }}" | grep "{{ pod.name }}"
register: podinstance
failed_when:
- podinstance.stdout_lines | length == 0
Expand Down