Skip to content

Commit 490b7d6

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 2e21312 commit 490b7d6

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

roles/test_operator/tasks/tempest-tests.yml

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

0 commit comments

Comments
 (0)