From 7596cd422f5e1b1954623f17a3005c1305e70634 Mon Sep 17 00:00:00 2001 From: Andrej Podhradsky Date: Thu, 9 May 2024 16:10:24 +0200 Subject: [PATCH] Properly set multiline custom CA Bundle Signed-off-by: Andrej Podhradsky --- ods_ci/libs/Helpers.py | 10 ++++++++++ .../130__rhods_operator/139__trusted_ca_bundles.robot | 1 + 2 files changed, 11 insertions(+) diff --git a/ods_ci/libs/Helpers.py b/ods_ci/libs/Helpers.py index e195db877..318bc3043 100644 --- a/ods_ci/libs/Helpers.py +++ b/ods_ci/libs/Helpers.py @@ -302,3 +302,13 @@ def is_string_empty(self, string): SyntaxError: EOL while scanning string literal (, line 1) """ return string is None or string == "" + + @keyword + def multiline_to_oneline_string(self, multiline_string, delimeter=" "): + """ + Converts a mutliline string into a oneline string with a provided delimeter. + Robot Framework doesn't properly handle multi-line strings and throws + Evaluating expression '"...".replace('', '\n')' failed: + SyntaxError: unterminated string literal (detected at line 1) (, line 1) + """ + return multiline_string.replace("\n", delimeter) diff --git a/ods_ci/tests/Tests/100__deploy/130__operators/130__rhods_operator/139__trusted_ca_bundles.robot b/ods_ci/tests/Tests/100__deploy/130__operators/130__rhods_operator/139__trusted_ca_bundles.robot index 404c5b12b..898a89093 100644 --- a/ods_ci/tests/Tests/100__deploy/130__operators/130__rhods_operator/139__trusted_ca_bundles.robot +++ b/ods_ci/tests/Tests/100__deploy/130__operators/130__rhods_operator/139__trusted_ca_bundles.robot @@ -110,6 +110,7 @@ Check ConfigMap Contains CA Bundle Key Set Custom CA Bundle Value In DSCI [Documentation] Set Custom CA Bundle value in DSCI [Arguments] ${DSCI} ${custom_ca_bundle_value} ${namespace} + ${custom_ca_bundle_value}= Multiline To Oneline String ${custom_ca_bundle_value} \\n ${rc} ${output}= Run And Return Rc And Output ... oc patch DSCInitialization/${DSCI} -n ${namespace} -p '{"spec":{"trustedCABundle":{"customCABundle":"${custom_ca_bundle_value}"}}}' --type merge Should Be Equal "${rc}" "0" msg=${output}