Skip to content

Commit e2ddcba

Browse files
committed
Add Charge Back test role
1 parent 80f6174 commit e2ddcba

File tree

2 files changed

+32
-17
lines changed

2 files changed

+32
-17
lines changed
Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
11
---
2-
- name: Verify OpenStack Rating Module are correctly enabled, disabled
3-
hosts: localhost
4-
connection: local
5-
gather_facts: false
2+
- name: Get status of all CloudKitty rating modules
3+
ansible.builtin.command:
4+
cmd: "openstack rating module list"
5+
changed_when: false
6+
register: module_list
67

7-
tasks:
8-
- name: Verify that exactly 2 rating modules are enabled
9-
become: true
10-
ansible.builtin.shell:
11-
cmd: "[[ $(openstack rating module list | grep True | wc -l) -eq 2 ]]"
12-
changed_when: false
8+
- name: TEST Validate CloudKitty module states
9+
ansible.builtin.assert:
10+
that:
11+
- "'noop' in module_list.stdout and 'True' in (module_list.stdout_lines | select('search', 'noop') | first)"
12+
- "'hashmap' in module_list.stdout and 'True' in (module_list.stdout_lines | select('search', 'hashmap') | first)"
13+
- "'pyscripts' in module_list.stdout and 'False' in (module_list.stdout_lines | select('search', 'pyscripts') | first)"
14+
fail_msg: "CloudKitty module validation FAILED. Module states are not as expected."
15+
success_msg: "SUCCESS: CloudKitty modules (noop=True, hashmap=True, pyscripts=False) are configured correctly."
1316

14-
- name: Verify that exactly 1 'pyscripts' module is disabled
15-
become: true
16-
ansible.builtin.shell:
17-
cmd: "[[ $(openstack rating module list | grep pyscripts | grep False | wc -l) -eq 1 ]]"
18-
changed_when: false
17+
- name: Find the current value of hashmap
18+
ansible.builtin.shell:
19+
cmd: |
20+
"openstack rating module get hashmap -c Priority -f csv | tail -n +2"
21+
register: start_hashmap_priority
22+
changed_when: start_hashmap_priority.stdout | trim != '100'
1923

24+
- name: TEST Set priority for CloudKitty hashmap module
25+
ansible.builtin.command:
26+
cmd: "openstack rating module set priority hashmap 100"
27+
register: set_hashmap_priority
28+
when: start_hashmap_priority.stdout | trim != '100'
29+
failed_when: set_hashmap_priority.rc >= 1 or set_hashmap_priority.stdout == ""
30+
changed_when: set_hashmap_priority.rc == 0
31+
32+
- name: Print result of hashmap priority value change
33+
ansible.builtin.debug:
34+
msg: "The hashmap priority is set to 100"
35+
when: (start_hashmap_priority.stdout | trim == '100') or (set_hashmap_priority.rc is defined and set_hashmap_priority.rc == 0)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
---
2-
- name: "Verify chargeback tests"
3-
when: chargeback_user_list is defined
2+
- name: "Validate ChargeBack Feature"
43
ansible.builtin.include_tasks: "chargeback_tests.yml"

0 commit comments

Comments
 (0)