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

[common] Use a config dict for configuring tests #203

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ skip_list:
- command-instead-of-module # Using command rather than module
- galaxy
- meta-no-info # meta/main.yml should contain relevant info
- name[template] # Jinja templates should only be at the end of 'name'
- risky-shell-pipe # Shells that use pipes should set the pipefail option
- unnamed-task # All tasks should be named
- var-naming[no-role-prefix] # Variables names from within roles should use role_name_ as a prefix
Expand Down
10 changes: 5 additions & 5 deletions ci/logging_tests_computes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
journal_test_id: "RHOSO-12681"
journal_list:
- ceilometer_agent_compute
- nova_compute
#telemetry_logging_journal_test_id: "RHOSO-12681"
telemetry_logging_journal_list:
- { name: ceilometer_agent_compute, test_id: "RHOSO-12681" }
- { name: nova_compute, test_id: "RHOSO-12681" }
tasks:
- name: "Run Telemetry Logging tests"
ansible.builtin.import_role:
ansible.builtin.include_role:
name: telemetry_logging
130 changes: 66 additions & 64 deletions ci/logging_tests_controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,48 @@
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOS0-12672"
common_pod_status_str: "Running"
common_pod_nspace: openstack-operators
common_pod_test_id: "RHOSO-12672"
# common_pod_status_str: "Running"
# common_pod_nspace: openstack-operators
common_pod_list:
- telemetry-operator-controller-manager
- openstack-operator-controller-manager
- { name: telemetry-operator-controller-manager, nspace: openstack-operators, status_str: "Running", test_id: "RHOSO-13761" }
- { name: openstack-operator-controller-manager, nspace: openstack-operators, status_str: "Running", test_id: "RHOSO-13762" }
common_subscription_test_id: "RHOSO-12678"
common_subscription_nspace: openshift-operators-redhat
# common_subscription_nspace: openshift-operators-redhat
common_subscription_list:
- loki-operator
- { name: loki-operator, nspace: openshift-operators-redhat, test_id: "RHOSO-12678"}
common_project_test_id: "RHOSO-12668"
common_project_list:
- openshift-openstack-infra
- openshift
- openstack-operators
- openshift-logging
- { name: openshift-openstack-infra, test_id: "RHOSO-13764" }
- { name: openshift, test_id: "RHOSO-13763"}
- { name: openstack-operators, test_id: "RHOSO-13732" }
- { name: openshift-logging, test_id: "RHOSO-13731"}
common_service_test_id: "RHOSO-12675"
common_service_nspace: openshift-logging
# 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
- openstack-logging
- { name: cluster-logging-operator-metrics, nspace: openshift-logging,test_id: "RHOSO-13744"}
- { name: logging-loki-compactor-grpc, nspace: openshift-logging, test_id: "RHOSO-13746"}
- { name: logging-loki-compactor-http, nspace: openshift-logging, test_id: "RHOSO-13747"}
- { name: logging-loki-distributor-grpc, nspace: openshift-logging, test_id: "RHOSO-13748"}
- { name: logging-loki-distributor-http, nspace: openshift-logging, test_id: "RHOSO-13749"}
- { name: logging-loki-gateway-http, nspace: openshift-logging, test_id: "RHOSO-13750"}
- { name: logging-loki-gossip-ring, nspace: openshift-logging, test_id: "RHOSO-13751"}
- { name: logging-loki-index-gateway-grpc, nspace: openshift-logging, test_id: "RHOSO-13752"}
- { name: logging-loki-index-gateway-http, nspace: openshift-logging, test_id: "RHOSO-13753"}
- { name: logging-loki-ingester-grpc, nspace: openshift-logging, test_id: "RHOSO-13754"}
- { name: logging-loki-ingester-http, nspace: openshift-logging, test_id: "RHOSO-13755"}
- { name: logging-loki-querier-grpc, nspace: openshift-logging, test_id: "RHOSO-13756"}
- { name: logging-loki-querier-http, nspace: openshift-logging, test_id: "RHOSO-13757"}
- { name: logging-loki-query-frontend-grpc, nspace: openshift-logging, test_id: "RHOSO-13758"}
- { name: logging-loki-query-frontend-http, nspace: openshift-logging, test_id: "RHOSO-13759"}
- { name: openstack-logging, nspace: openshift-logging, test_id: "RHOSO-13760"}

common_file_test_id: "RHOSO-12754"
common_file_list:
- /etc/rsyslog.d/10-telemetry.conf
- { name: "/etc/rsyslog.d/10-telemetry.conf", test_id: "{{ common_file_test_id }}"}
tasks:
- name: "Verify logging infrastructure components"
ansible.builtin.import_role:
ansible.builtin.include_role:
name: common

- name: "Verify logging pods are running in openstack"
Expand All @@ -59,13 +60,13 @@
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12752"
common_pod_status_str: "Running"
common_pod_nspace: openstack
# common_pod_status_str: "Running"
# common_pod_nspace: openstack
common_pod_list:
- openstackclient
- { name: openstackclient, status_str: "Running", nspace: "openstack", test_id: "RHOSO-12752"}
tasks:
- name: "Verify Running Pods"
ansible.builtin.import_role:
ansible.builtin.include_role:
name: common


Expand All @@ -78,13 +79,13 @@
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12673"
common_pod_status_str: "Running"
common_pod_nspace: openshift-operators-redhat
#common_pod_status_str: "Running"
#common_pod_nspace: openshift-operators-redhat
common_pod_list:
- loki-operator-controller-manager
- { name: loki-operator-controller-manager, nspace: openshift-operators-redhat, status_str: "Running", test_id: "RHOSO-12673"}
tasks:
- name: "Verify Pods running"
ansible.builtin.import_role:
ansible.builtin.include_role:
name: common

- name: "Verify logging pods are running in openshift-logging"
Expand All @@ -96,23 +97,24 @@
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12676"
common_pod_status_str: "Running"
common_pod_nspace: openshift-logging
# common_pod_status_str: "Running"
# common_pod_nspace: openshift-logging
common_pod_list:
- cluster-logging-operator
- logging-loki-compactor
- logging-loki-distributor
#- logging-loki-gateway
- logging-loki-index-gateway
- logging-loki-ingester
- logging-loki-querier
- logging-loki-query-frontend
- collector
- { name: cluster-logging-operator, nspace: openshift-logging, status_str: "Running", test_id: "{{ common_pod_test_id }}" }
- { name: logging-loki-compactor, nspace: openshift-logging, status_str: "Running", test_id: "RHOSO-13778" }
- { name: logging-loki-distributor, nspace: openshift-logging, status_str: "Running", test_id: "RHOSO-13780" }
#- { name: logging-loki-gateway, nspace: openshift-logging, status_str: "Running", test_id: "{{ common_pod_test_id }}" }
- { name: logging-loki-index-gateway, nspace: openshift-logging, status_str: "Running", test_id: "RHOSO-13781" }
- { name: logging-loki-ingester, nspace: openshift-logging, status_str: "Running", test_id: "RHOSO-13782" }
- { name: logging-loki-querier, nspace: openshift-logging, status_str: "Running", test_id: "RHOSO-13783" }
- { name: logging-loki-query-frontend, nspace: openshift-logging, status_str: "Running", test_id: "RHOSO-13784" }
- { name: collector, nspace: openshift-logging, status_str: "Running", test_id: "RHOSO-13745"}


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

- name: "Verify logging pods are running in minio-dev"
Expand All @@ -124,13 +126,13 @@
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12674"
common_pod_status_str: "Running"
common_pod_nspace: minio-dev
# common_pod_status_str: "Running"
# common_pod_nspace: minio-dev
common_pod_list:
- minio
- { name: minio, nspace: minio-dev, status_str: "Running", test_id: "RHOSO-12674" }
tasks:
- name: "Run pod running tests"
ansible.builtin.import_role:
ansible.builtin.include_role:
name: common


Expand All @@ -143,13 +145,13 @@
PATH: "{{ cifmw_path }}"
vars:
common_pod_test_id: "RHOSO-12679"
common_pod_nspace: openstack
common_pod_status_str: "Completed"
#common_pod_nspace: openstack
#common_pod_status_str: "Completed"
common_pod_list:
- logging-edpm-deployment-openstack-edpm-ipam
- { name: logging-edpm-deployment-openstack-edpm-ipam, nspace: openstack, status_str: "Completed", test_id: "RHOSO-12679"}
tasks:
- name: "Run pods completed tests"
ansible.builtin.import_role:
ansible.builtin.include_role:
name: common

- name: "Verify the crds exist"
Expand All @@ -160,13 +162,13 @@
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars:
common_crd_test_id: "RHOSO-12670"
#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
- { name: alertingrules.loki.grafana.com, test_id: "RHOSO-12670"}
- { name: lokistacks.loki.grafana.com, test_id: "RHOSO-13787"}
- { name: recordingrules.loki.grafana.com, test_id: "RHOSO-13788"}
- { name: rulerconfigs.loki.grafana.com, test_id: "RHOSO-13789"}
tasks:
- name: "Run the crds tests"
ansible.builtin.import_role:
ansible.builtin.include_role:
name: common
10 changes: 6 additions & 4 deletions roles/common/tasks/container_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
- name: Get container status
ansible.builtin.shell:
cmd: |
podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep {{ container_name }}
podman ps -a --format "{{ '{{.Names}} {{.Status}}' }}" | grep {{ container.name }}
changed_when: false
register: container_status

- name: Verify container status {{ common_container_test_id }}
- name: |
Verify {{ container.name }} container status
{{ container.test_id if container.test_id is defined }}
ansible.builtin.assert:
that:
- "'unhealthy' not in container_status.stdout"
success_msg: "Container '{{ container_name }}' is in 'healthy' status."
fail_msg: "Container '{{ container_name }}' is not in 'healthy' status. Current status: {{ container_status.stdout }}"
success_msg: "Container '{{ container.name }}' is in 'healthy' status."
fail_msg: "Container '{{ container.name }}' is not in 'healthy' status. Current status: {{ container_status.stdout }}"
15 changes: 10 additions & 5 deletions roles/common/tasks/cr_tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
- name: Verify that a CR exists {{ common_cr_test_id }}
---
- name: |
TEST Verify that the {{ cr.kind }} {{ cr.name }} CR exists
{{ common_cr_test_id }}
ansible.builtin.command:
cmd: |
oc get {{ item.kind }} {{ item.name }}
oc get {{ cr.kind }} {{ cr.name }}
register: result
changed_when: false
failed_when:
- result.rc != 0

- name: Verify that a CR is ready {{ common_cr_ready_test_id }}
- name: |
TEST Verify that the {{ cr.kind }} {{ cr.name }} CR is {{ cr.condition_type }}
{{ common_cr_ready_test_id }}
ansible.builtin.command:
cmd: |
oc get {{ item.kind }} {{ item.name }} -o jsonpath='{.status.conditions[?(@.type=="{{ item.condition_type }}")].status}{"\n"}'
oc get {{ cr.kind }} {{ cr.name }} -o jsonpath='{.status.conditions[?(@.type=="{{ cr.condition_type }}")].status}{"\n"}'
register: result
changed_when: false
failed_when:
- result.stdout != "True"
when:
- common_cr_ready_test_id is defined
- item.condition_type is defined
- cr.condition_type is defined
12 changes: 7 additions & 5 deletions roles/common/tasks/crd_tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
- name: Verify CRD "{{ item }}"
- name: Verify CRD "{{ crd.name }}"
ansible.builtin.shell:
cmd: |
oc get crd "{{ item }}"
oc get crd "{{ crd.name }}"
changed_when: false
register: output

- name: Verify CRD is found "{{ common_crd_test_id }}"
- name: |
TEST Verify CRD {{ crd.name }} is found
{{ crd.test_id if crd.test_id is defined }}
ansible.builtin.assert:
that:
- "'NotFound' not in output.stderr"
success_msg: "CRD {{ item }} is found."
fail_msg: "CRD {{ item }} not found. Error: {{ output.stderr }}"
success_msg: "CRD {{ crd.name }} is found."
fail_msg: "CRD {{ crd.name }} not found. Error: {{ output.stderr }}"
12 changes: 7 additions & 5 deletions roles/common/tasks/endpoint_tests.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
- name: Verify endpoint "{{ item }}"
- name: Verify endpoint "{{ endpoint }}"
ansible.builtin.shell:
cmd: |
{{ openstack_cmd }} endpoint list --service {{ item[0] }} --interface {{ item[2] }}
{{ openstack_cmd }} endpoint list --service {{ endpoint[0] }} --interface {{ endpoint[2] }}
changed_when: false
register: output

- name: Check that endpoint exist {{ common_endpoint_test_id }}
- name: |
TEST Check that {{ endpoint[0] }} endpoint exists
{{ common_endpoint_test_id }}
ansible.builtin.assert:
that:
- output.stdout != ""
success_msg: "The endpoint {{ item[0] }} is found."
fail_msg: "The endpoint for service {{ item[0] }} "
success_msg: "The endpoint {{ endpoint[0] }} is found."
fail_msg: "The endpoint for service {{ endpoint[0] }} "
6 changes: 3 additions & 3 deletions roles/common/tasks/file_tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
- name: Get stats for file - "{{ item }}"
- name: Get stats for file - "{{ file.name }}"
ansible.builtin.stat:
path: "{{ item }}"
path: "{{ ifile.name }}"
register: fstats
failed_when:
- fstats.stat.pw_name != "root"
- fstats.stat.size | int < 300
- not fstats.stat.exists
- not fstats.stat.isreg
- not fstats.stat.isreg
Loading