Skip to content

Commit ab1dee2

Browse files
committed
Adding common tests for chargeback project
1 parent e2ddcba commit ab1dee2

File tree

8 files changed

+319
-103
lines changed

8 files changed

+319
-103
lines changed

ci/chargeback_tests.yml

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
---
2+
- name: "Verify logging projects, endpoints, credentials, nodes, pods, services, manifests and subscriptions"
3+
hosts: controller
4+
gather_facts: no
5+
ignore_errors: true
6+
environment:
7+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
8+
PATH: "{{ cifmw_path }}"
9+
vars_files:
10+
- vars/osp18_env.yml
11+
vars:
12+
common_pod_test_id: ""
13+
common_pod_status_str: "Running"
14+
common_pod_nspace: openstack-operators
15+
common_pod_list:
16+
- telemetry-operator-controller-manager
17+
- openstack-operator-controller-manager
18+
19+
common_subscription_test_id: ""
20+
common_subscription_nspace: openshift-operators-redhat
21+
common_subscription_list:
22+
- loki-operator
23+
24+
common_project_test_id: ""
25+
common_project_list:
26+
- openshift-openstack-infra
27+
- openshift
28+
- openstack-operators
29+
- openshift-logging
30+
31+
common_endpoint_test_id: ""
32+
common_endpoint_list:
33+
- [nova,compute,public]
34+
- [nova,compute,internal]
35+
- [placement,placement,public]
36+
- [placement,placement,internal]
37+
- [swift,object-store,public]
38+
- [swift,object-store,internal]
39+
- [cinderv3,volumev3,public]
40+
- [cinderv3,volumev3,internal]
41+
- [barbican,key-manager,public]
42+
- [barbican,key-manager,internal]
43+
- [keystone,identity,public]
44+
- [keystone,identity,internal]
45+
- [glance,image,public]
46+
- [glance,image,internal]
47+
- [neutron,network,public]
48+
- [neutron,network,internal]
49+
50+
common_manifest_test_id: ""
51+
common_manifest_list:
52+
- "loki-operator 2"
53+
- "loki-helm-operator 1"
54+
55+
common_service_test_id: ""
56+
common_service_nspace: openshift-logging
57+
common_service_list:
58+
- cluster-logging-operator-metrics
59+
- logging-loki-compactor-grpc
60+
- logging-loki-compactor-http
61+
- logging-loki-distributor-grpc
62+
- logging-loki-distributor-http
63+
- logging-loki-gateway-http
64+
- logging-loki-gossip-ring
65+
- logging-loki-index-gateway-grpc
66+
- logging-loki-index-gateway-http
67+
- logging-loki-ingester-grpc
68+
- logging-loki-ingester-http
69+
- logging-loki-querier-grpc
70+
- logging-loki-querier-http
71+
- logging-loki-query-frontend-grpc
72+
- logging-loki-query-frontend-http
73+
- openstack-logging
74+
75+
tasks:
76+
- name: "Verify logging infrastructure components"
77+
ansible.builtin.import_role:
78+
name: common
79+
80+
81+
- name: "Verify logging pods are running in openstack"
82+
hosts: controller
83+
gather_facts: no
84+
ignore_errors: true
85+
environment:
86+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
87+
PATH: "{{ cifmw_path }}"
88+
vars:
89+
common_pod_test_id: ""
90+
common_pod_status_str: "Running"
91+
common_pod_nspace: openstack
92+
common_pod_list:
93+
- openstackclient
94+
tasks:
95+
- name: "Verify Running Pods"
96+
ansible.builtin.import_role:
97+
name: common
98+
99+
100+
- name: "Verify logging pods are running in openshift-operators-redhat"
101+
hosts: controller
102+
gather_facts: no
103+
ignore_errors: true
104+
environment:
105+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
106+
PATH: "{{ cifmw_path }}"
107+
vars:
108+
common_pod_test_id: ""
109+
common_pod_status_str: "Running"
110+
common_pod_nspace: openshift-operators-redhat
111+
common_pod_list:
112+
- loki-operator-controller-manager
113+
tasks:
114+
- name: "Verify Pods running"
115+
ansible.builtin.import_role:
116+
name: common
117+
118+
- name: "Verify logging pods are running in openshift-logging"
119+
hosts: controller
120+
gather_facts: no
121+
ignore_errors: true
122+
environment:
123+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
124+
PATH: "{{ cifmw_path }}"
125+
vars:
126+
common_pod_test_id: ""
127+
common_pod_status_str: "Running"
128+
common_pod_nspace: openshift-logging
129+
common_pod_list:
130+
- cluster-logging-operator
131+
- logging-loki-compactor
132+
- logging-loki-distributor
133+
- logging-loki-index-gateway
134+
- logging-loki-ingester
135+
- logging-loki-querier
136+
- logging-loki-query-frontend
137+
- collector
138+
139+
tasks:
140+
- name: "Verify Pods running"
141+
ansible.builtin.import_role:
142+
name: common
143+
144+
- name: "Verify logging pods are running in minio-dev"
145+
hosts: controller
146+
gather_facts: no
147+
ignore_errors: true
148+
environment:
149+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
150+
PATH: "{{ cifmw_path }}"
151+
vars:
152+
common_pod_test_id: ""
153+
common_pod_status_str: "Running"
154+
common_pod_nspace: minio-dev
155+
common_pod_list:
156+
- minio
157+
tasks:
158+
- name: "Run pod running tests"
159+
ansible.builtin.import_role:
160+
name: common
161+
162+
163+
- name: "Verify logging pods have complete status in openstack"
164+
hosts: controller
165+
gather_facts: no
166+
ignore_errors: true
167+
environment:
168+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
169+
PATH: "{{ cifmw_path }}"
170+
vars:
171+
common_pod_test_id: ""
172+
common_pod_nspace: openstack
173+
common_pod_status_str: "Completed"
174+
common_pod_list:
175+
- bootstrap-edpm-deployment-openstack-edpm-ipam
176+
- configure-network-edpm-deployment-openstack-edpm-ipam
177+
- configure-os-edpm-deployment-openstack-edpm-ipam
178+
- install-certs-edpm-deployment-openstack-edpm-ipam
179+
- install-os-edpm-deployment-openstack-edpm-ipam
180+
- libvirt-edpm-deployment-openstack-edpm-ipam
181+
- logging-edpm-deployment-openstack-edpm-ipam
182+
- neutron-metadata-edpm-deployment-openstack-edpm-ipam
183+
- ovn-edpm-deployment-openstack-edpm-ipam
184+
- reboot-os-edpm-deployment-openstack-edpm-ipam
185+
- run-os-edpm-deployment-openstack-edpm-ipam
186+
- ssh-known-hosts-edpm-deployment
187+
- telemetry-edpm-deployment-openstack-edpm-ipam
188+
- validate-network-edpm-deployment-openstack-edpm-ipam
189+
tasks:
190+
- name: "Run pods completed tests"
191+
ansible.builtin.import_role:
192+
name: common
193+
194+
195+
- name: "Verify the crds exist"
196+
hosts: controller
197+
gather_facts: no
198+
ignore_errors: true
199+
environment:
200+
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
201+
PATH: "{{ cifmw_path }}"
202+
vars:
203+
common_service_test_id: ""
204+
common_service_nspace: openstack
205+
common_service_list:
206+
- nova-internal
207+
- nova-metadata-internal
208+
- nova-novncproxy-cell1-public
209+
- nova-public
210+
common_crd_test_id: ""
211+
common_crd_list:
212+
- alertingrules.loki.grafana.com
213+
- lokistacks.loki.grafana.com
214+
- recordingrules.loki.grafana.com
215+
- rulerconfigs.loki.grafana.com
216+
tasks:
217+
- name: "Run Services and CRD tests"
218+
ansible.builtin.import_role:
219+
name: common

roles/observe_chargeback/README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
observe_chargeback
1+
Ansible Playbook: CloudKitty ChargeBack Validation
22
=========
33

4-
Test chargeback in Openstack
4+
This Ansible playbook validates and enforces the configuration of the OpenStack CloudKitty (chargeback) service. It performs a series of tests to ensure that the CloudKitty rating modules are in the correct state and that the `hashmap` module has the correct priority.
55

6-
Requirements
7-
------------
6+
Playbook Files
7+
---------
8+
9+
* **`main.yml`**: The main playbook entry point. It includes the `chargeback_tests.yml` file to execute the validation logic.
10+
* **`chargeback_tests.yml`**: This task file contains the sequence of steps used to validate and configure the CloudKitty service.
11+
12+
Workflow
13+
---------
14+
15+
The `chargeback_tests.yml` playbook executes the following steps:
816

9-
Role Variables
10-
--------------
17+
1. **Get Module Status**: It first runs the `{{ openstack_cmd }} rating module list` command to fetch the current status of all CloudKitty rating modules.
1118

12-
For chargeback_tests.yml
19+
2. **Validate Module States**: It uses an `assert` task to test for specific, expected conditions. The playbook will **fail** if these are not met:
20+
* The `noop` module must be **enabled** (`True`).
21+
* The `hashmap` module must be **enabled** (`True`).
22+
* The `pyscripts` module must be **disabled** (`False`).
1323

14-
chargeback_test_id
15-
- polarion id for test
16-
chargeback_user_list
17-
- List of users to check for resource usage
24+
3. `Check Hashmap Priority`: It runs a shell command to find the current priority value of the `hashmap` module.
1825

19-
Dependencies
20-
------------
26+
4. `Set Hashmap Priority`: It idempotently sets the `hashmap` module's priority to `100`. This task is skipped if the priority is already set to `100`.
2127

22-
Openstack on Openshift deployed and telemetry enabled for Openstack.
2328

24-
Example Playbook
25-
----------------
2629

27-
Each tasks/playbook.yml should be called independently via "ansible.builtin.import_role" with appropriate vars passed:
30+
Requirements
31+
---------
32+
33+
This playbook relies on an Ansible variable, `openstack_cmd`, which must be defined when running the playbook.
34+
35+
This variable must contain the full command necessary to execute OpenStack CLI commands (e.g., `/usr/bin/openstack` or simply `openstack` if it's in the system's PATH).
36+
The host running the playbook must have access to the OpenStack environment and the necessary credentials loaded for the CLI to function.
2837

29-
- name: "Verify chargeback reporting"
30-
hosts: controller
31-
gather_facts: no
32-
vars:
33-
chargeback_user_list:
34-
- "user1"
35-
- "user2"
3638

37-
tasks:
38-
- name: "Verify chargeback data"
39-
ansible.builtin.import_role:
40-
name: observe_chargeback
39+
Usage
40+
---------
4141

42+
You can run this playbook using the `ansible-playbook` command. You must pass the `openstack_cmd` variable as an extra argument.
4243

43-
License
44-
-------
44+
Example of running the playbook in bash shell:
45+
``ansible-playbook main.yml -e "openstack_cmd=/usr/bin/openstack``
4546

46-
Apache 2
4747

4848
Author Information
4949
------------------
5050

51-
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
51+
Alex Yefimov

0 commit comments

Comments
 (0)