From 51a10ae45433473ac4253921ccccce88e88ab1c4 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 ecef9e92f..5f4591514 100644 --- a/ods_ci/libs/Helpers.py +++ b/ods_ci/libs/Helpers.py @@ -310,3 +310,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 bd3cb8221..edc7348fa 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 @@ -145,6 +145,7 @@ Delete Namespace From Openshift 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}