Skip to content
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
48 changes: 25 additions & 23 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,27 @@
irrelevant-files: *irrelevant_files
required-projects: *required_projects

- job:
name: functional-chargeback-tests-osp18
parent: telemetry-operator-multinode-cloudkitty
description: |
Alias of telemetry-operator-multinode-cloudkitty for testing
irrelevant-files: []
roles:
- zuul: github.com/openstack-k8s-operators/ci-framework
- zuul: github.com/infrawatch/feature-verification-tests
required-projects:
- name: github.com/openstack-k8s-operators/telemetry-operator
override-checkout: main
- name: github.com/infrawatch/feature-verification-tests
vars:
cifmw_extras:
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir }}/scenarios/centos-9/multinode-ci.yml"
# Need a config for CK
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/openstack-k8s-operators/telemetry-operator'].src_dir }}/ci/vars-cloudkitty-tempest.yml"
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/vars-use-master-containers.yml"
- "@{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/vars-cloudkitty-fvt.yml"

- project:
name: infrawatch/feature-verification-tests
periodic:
Expand All @@ -167,26 +188,7 @@
jobs:
- telemetry-openstack-meta-content-provider-master:
override-checkout: main
- feature-verification-tests-noop:
files: *irrelevant_files
- functional-tests-osp18
- functional-logging-tests-osp18:
irrelevant-files: *irrelevant_files
files:
- roles/telemetry_logging/.*
- roles/common/*
- .zuul.yaml
- ci/vars-logging-test.yml
- ci/logging_tests_all.yml
- ci/logging_tests_computes.yml
- ci/logging_tests_controller.yml
- ci/report_result.yml
- .zuul.yaml
- functional-periodic-telemetry-with-ceph:
files:
# Run this job for changes to the volume_pool_metrics test changes as this is
# the only job, where those tests get executed and for changes to zuul.yaml in
# case the job definition changes.
- roles/telemetry_verify_metrics/tasks/verify_ceilometer_volume_pool_metrics.yml
- .zuul.yaml

- functional-chargeback-tests-osp18:
override-checkout: main
dependencies:
- telemetry-openstack-meta-content-provider-master
61 changes: 61 additions & 0 deletions ci/run_chargeback_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
- name: "Verify all the applicable projects, endpoints, pods & services for cloudkitty"
hosts: "{{ cifmw_target_hook_host | default('localhost') }}"
gather_facts: no
ignore_errors: true
environment:
KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
PATH: "{{ cifmw_path }}"
vars_files:
- vars/osp18_env.yml
vars:
common_pod_status_str: "Running"
common_pod_nspace: openstack
common_pod_list:
- cloudkitty-api
- cloudkitty-lokistack-compactor
- cloudkitty-lokistack-distributor
# pod tests expect only one instance of a pod, there are two of this one
# Some work is needed on the pod tests to deal with this test case
#- cloudkitty-lokistack-gateway
- cloudkitty-lokistack-index-gateway
- cloudkitty-lokistack-ingester
- cloudkitty-lokistack-querier
- cloudkitty-lokistack-query-frontend
- cloudkitty-proc

common_project_list:
- openstack
- openstack-operators

common_endpoint_list:
- [cloudkitty,rating,public]
- [cloudkitty,rating,internal]

common_service_nspace: openstack
common_service_list:
- cloudkitty-internal
- cloudkitty-lokistack-compactor-grpc
- cloudkitty-lokistack-compactor-http
- cloudkitty-lokistack-distributor-grpc
- cloudkitty-lokistack-distributor-http
- cloudkitty-lokistack-gateway-http
- cloudkitty-lokistack-gossip-ring
- cloudkitty-lokistack-index-gateway-grpc
- cloudkitty-lokistack-index-gateway-http
- cloudkitty-lokistack-ingester-grpc
- cloudkitty-lokistack-ingester-http
- cloudkitty-lokistack-querier-grpc
- cloudkitty-lokistack-querier-http
- cloudkitty-lokistack-query-frontend-grpc
- cloudkitty-lokistack-query-frontend-http
- cloudkitty-public

tasks:
- name: "Verify cloudkitty infrastructure components"
ansible.builtin.import_role:
name: common

- name: "Verify cloudkitty deployment"
ansible.builtin.import_role:
name: telemetry_chargeback
5 changes: 5 additions & 0 deletions ci/vars-cloudkitty-fvt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
pre_tests_01_run_chargeback_tests:
source: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/run_chargeback_tests.yml"
type: playbook
config_file: "{{ ansible_user_dir }}/{{ zuul.projects['github.com/infrawatch/feature-verification-tests'].src_dir }}/ci/ansible.cfg"
47 changes: 47 additions & 0 deletions roles/telemetry_chargeback/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
telemetry_chargeback
=========
The **`telemetry_chargeback`** role is designed to test the **RHOSO Cloudkitty** feature. These tests are specific to the Cloudkitty feature. Tests that are not specific to this feature (e.g., standard OpenStack deployment validation, basic networking) should be added to a common role.

Requirements
------------
It relies on the following being available on the target or control host:

* This role requires **Ansible 2.9** or newer.
* The **OpenStack CLI client** must be installed and configured with administrative credentials.
* Required Python libraries for the `openstack` CLI (e.g., `python3-openstackclient`).
* Connectivity to the OpenStack API endpoint.

It is expected to be run **after** a successful deployment and configuration of the following components:

* **OpenStack:** A functional OpenStack cloud (RHOSO) environment.
* **Cloudkitty:** The Cloudkitty service must be installed, configured, and running.

Role Variables
--------------
The role uses a few primary variables to control the testing environment and execution.

| Variable | Default Value | Description |
|----------|---------------|-------------|
| `openstack_cmd` | `openstack` | The command used to execute OpenStack CLI calls. This can be customized if the binary is not in the standard PATH. |
Comment thread
ayefimov-1 marked this conversation as resolved.

Dependencies
------------
This role has no direct hard dependencies on other Ansible roles.

Example Playbook
----------------
```yaml
- name: "Run chargeback tests"
hosts: controllers
gather_facts: no

tasks:
- name: "Run chargeback specific tests"
ansible.builtin.import_role:
name: telemetry_chargeback
```

Author Information
------------------

Alex Yefimov, Red Hat
2 changes: 2 additions & 0 deletions roles/telemetry_chargeback/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
openstack_cmd: "openstack"
13 changes: 13 additions & 0 deletions roles/telemetry_chargeback/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
galaxy_info:
author: Alex Yefimov
description: Tests the chargeback feature is set up in OpenStack running on OpenShift
company: Red Hat

license: Apache-2.0

min_ansible_version: "2.1"

galaxy_tags: []

dependencies: []
42 changes: 42 additions & 0 deletions roles/telemetry_chargeback/tasks/chargeback_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
- name: Enable Cloudkitty Module (hashmap)
ansible.builtin.command:
cmd: "{{ openstack_cmd }} rating module enable hashmap"
register: enable_hashmap
changed_when: True
Comment thread
ayefimov-1 marked this conversation as resolved.
failed_when: enable_hashmap.rc != 0

- name: Find the current value of hashmap
ansible.builtin.shell:
cmd: "{{ openstack_cmd }} rating module get hashmap -c Priority -f csv | tail -n +2"
register: get_hashmap_priority
changed_when: false

- name: Change priority for CloudKitty hashmap module
ansible.builtin.command:
cmd: "{{ openstack_cmd }} rating module set priority hashmap 100"
register: set_hashmap_priority
when: get_hashmap_priority.stdout | trim != '100'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more useful condition is to increase the priority of the hashmap module when it is lower than the pyscripts one.

This keeps the changes needed to a minimum.

Ideally, the system would be in the same state after tests as before it. (in this case, it would mean recording the original priority and restoring it after, but that is complex, and I would accept minimal changes i.e. only update the priority if it needs updating)

failed_when: set_hashmap_priority.rc >= 1 or get_hashmap_priority.stdout == ""
changed_when: True

- name: Get status of all CloudKitty rating modules
Comment thread
ayefimov-1 marked this conversation as resolved.
ansible.builtin.command:
cmd: "{{ openstack_cmd }} rating module list"
changed_when: false
register: module_list

- name: TEST Validate CloudKitty module states
ansible.builtin.assert:
that:
- "'hashmap' in module_list.stdout"
- "'True' in (module_list.stdout_lines | select('search', 'hashmap') | first)"
fail_msg: "FAILED: CloudKitty module validation failed . Module states are not as expected."
success_msg: "SUCCESS: CloudKitty modules (hashmap=True) are configured correctly."

- name: TEST Set priority for CloudKitty hashmap module
Comment thread
ayefimov-1 marked this conversation as resolved.
ansible.builtin.assert:
that:
- "(get_hashmap_priority.stdout | trim == '100') or (set_hashmap_priority.rc | default(-1) == 0)"
fail_msg: "FAILED: The hashmap priority is not set to 100"
success_msg: "SUCCESS: The hashmap priority is set to 100"
3 changes: 3 additions & 0 deletions roles/telemetry_chargeback/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- name: "Validate Chargeback Feature"
ansible.builtin.include_tasks: "chargeback_tests.yml"