Skip to content

Commit 1ea6b9c

Browse files
committed
Add building Tempest timing data url
There is a relatively new parameter added to test-operator, called TimingDataUrl. We are trying to make the parameter work with jobs, but the issue is that there is no variable that stores the final Tempest pod name that will be created. Without it, we cannot build the timing data url, as we are saving the data under job/test-name folder. This change adds a way to build the final url for both tests with and without workflow.
1 parent b3778e5 commit 1ea6b9c

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

roles/test_operator/tasks/tempest-tests.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,71 @@
210210
stage_vars_dict |
211211
combine({'cifmw_test_operator_tempest_workflow': no_resources_workflow})
212212
}}
213+
214+
- name: Build tempest timing data URL (no workflow)
215+
when:
216+
- not cifmw_test_operator_dry_run | bool
217+
- stage_vars_dict.cifmw_test_operator_tempest_timing_data_url is defined
218+
- stage_vars_dict.cifmw_test_operator_tempest_timing_data_url
219+
- stage_vars_dict.cifmw_test_operator_tempest_workflow | length == 0
220+
vars:
221+
final_timing_data_url: >-
222+
{{
223+
stage_vars_dict.cifmw_test_operator_tempest_timing_data_url +
224+
test_operator_instance_name + '/stestr.tar.gz'
225+
}}
226+
ansible.builtin.set_fact:
227+
test_operator_cr: >-
228+
{{
229+
test_operator_cr |
230+
combine({'spec': {'timingDataUrl': final_timing_data_url}}, recursive=true)
231+
}}
232+
stage_vars_dict: >-
233+
{{
234+
stage_vars_dict |
235+
combine({'cifmw_test_operator_tempest_timing_data_url': final_timing_data_url})
236+
}}
237+
238+
- name: Build tempest timing data URL (workflow)
239+
when:
240+
- not cifmw_test_operator_dry_run | bool
241+
- stage_vars_dict.cifmw_test_operator_tempest_workflow | length > 0
242+
block:
243+
- name: Add the full timing data url to workflow steps
244+
vars:
245+
base_url: >-
246+
{{
247+
item.timingDataUrl | default(stage_vars_dict.get('cifmw_test_operator_tempest_timing_data_url', ''))
248+
}}
249+
final_timing_data_url: >-
250+
{{
251+
base_url + test_operator_instance_name + '-s' +
252+
'%02d' | format(step_number) + '-' + item.stepName + '/stestr.tar.gz'
253+
}}
254+
_timing_data_url_workflow_step: >-
255+
{{
256+
(base_url | length > 0)
257+
| ternary(
258+
item | combine({'timingDataUrl': final_timing_data_url}, recursive=true),
259+
item
260+
)
261+
}}
262+
ansible.builtin.set_fact:
263+
timing_data_url_workflow: "{{ timing_data_url_workflow | default([]) + [_timing_data_url_workflow_step] }}"
264+
loop: "{{ stage_vars_dict.cifmw_test_operator_tempest_workflow | list }}"
265+
loop_control:
266+
index_var: step_number
267+
268+
- name: Override the Tempest CR workflow
269+
when: timing_data_url_workflow is defined
270+
ansible.builtin.set_fact:
271+
test_operator_cr: >-
272+
{{
273+
test_operator_cr |
274+
combine({'spec': {'workflow': timing_data_url_workflow}}, recursive=true)
275+
}}
276+
stage_vars_dict: >-
277+
{{
278+
stage_vars_dict |
279+
combine({'cifmw_test_operator_tempest_workflow': timing_data_url_workflow})
280+
}}

0 commit comments

Comments
 (0)