-
Notifications
You must be signed in to change notification settings - Fork 16
Create chargeback role in obeservability FVT jobs #319
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| 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" |
| 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. | | ||
|
|
||
| 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| openstack_cmd: "openstack" |
| 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: [] |
| 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 | ||
|
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' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
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 | ||
|
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" | ||
| 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" |
Uh oh!
There was an error while loading. Please reload this page.