Skip to content

Commit 6e2c750

Browse files
committed
Making changes suggested in PR-335
1 parent ed02d87 commit 6e2c750

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

roles/telemetry_chargeback/files/gen_db_summary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ def extract_and_sort(json_path: Path) -> list[tuple[str, str]]:
145145
pass
146146

147147
# Fallback: extract array strings from raw text (multi-line safe)
148-
pairs = _find_arrays_in_text(raw)
149-
pairs.sort(key=lambda p: int(p[0]))
148+
# pairs = _find_arrays_in_text(raw)
149+
# pairs.sort(key=lambda p: int(p[0]))
150150
return pairs
151151

152152

roles/telemetry_chargeback/tasks/loki_rate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
- name: "TEST Get Rate and Qty by type from Cloudkitty {{ item }}"
33
ansible.builtin.command:
4-
cmd: "{{ openstack_cmd }} rating summary get -g type"
4+
cmd: "{{ openstack_cmd }} --rating-api-version 2 rating summary get -g type"
55
register: cost_totals_by_type
66
changed_when: true
77
failed_when: cost_totals_by_type.rc != 0
88

99
- name: "**INFO** Print the rating by type {{ item }}"
1010
ansible.builtin.debug:
11-
var: cost_totals_by_type
11+
var: cost_totals_by_type.stdout
1212

1313
- name: "Save output as a loadable variable file {{ item }}"
1414
ansible.builtin.copy:
@@ -26,4 +26,4 @@
2626

2727
- name: "**INFO** Print the rating summary {{ item }}"
2828
ansible.builtin.debug:
29-
var: cost_totals_summary
29+
var: cost_totals_summary.stdout

roles/telemetry_chargeback/tasks/run_test_scenarios.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,30 @@
99
ansible.builtin.include_tasks: "loki_rate.yml"
1010

1111
#### diff uploaded data totals vs download data totals
12+
- name: "Check synthetic totals file exists"
13+
ansible.builtin.stat:
14+
path: "{{ artifacts_dir_zuul }}/{{ item }}{{ cloudkitty_synth_totals_metrics_suffix }}"
15+
register: synth_totals_stat
16+
17+
- name: "Check loki totals file exists"
18+
ansible.builtin.stat:
19+
path: "{{ artifacts_dir_zuul }}/{{ item }}{{ cloudkitty_loki_totals_metrics_suffix }}"
20+
register: loki_totals_stat
21+
22+
- name: "TEST Totals files exist {{ item }}"
23+
ansible.builtin.assert:
24+
that:
25+
- synth_totals_stat.stat.exists | default(false)
26+
- loki_totals_stat.stat.exists | default(false)
27+
fail_msg: |
28+
FAILED! Required file(s) missing for scenario {{ item }}:
29+
- {{ artifacts_dir_zuul }}/{{ item }}{{ cloudkitty_synth_totals_metrics_suffix }}
30+
- {{ artifacts_dir_zuul }}/{{ item }}{{ cloudkitty_loki_totals_metrics_suffix }}
31+
success_msg: |
32+
PASSED! Required file(s) exist {{ item }}:
33+
- {{ artifacts_dir_zuul }}/{{ item }}{{ cloudkitty_synth_totals_metrics_suffix }}
34+
- {{ artifacts_dir_zuul }}/{{ item }}{{ cloudkitty_loki_totals_metrics_suffix }}
35+
1236
- name: "Read the synthetic totals file"
1337
ansible.builtin.slurp:
1438
src: "{{ artifacts_dir_zuul }}/{{ item }}{{ cloudkitty_synth_totals_metrics_suffix }}"
@@ -24,6 +48,5 @@
2448
that:
2549
# Compare data_log (gen_db_summary output has time and data_log only)
2650
- (synth_data.content | b64decode | from_yaml).data_log == (loki_data.content | b64decode | from_yaml).data_log
27-
fail_msg: |
28-
FAILED! {{ item }}
29-
success_msg: "PASSED - Data totals are identical."
51+
fail_msg: "FAILED! {{ item }}"
52+
success_msg: "PASSED! {{ item }} - Data totals are identical."

0 commit comments

Comments
 (0)