[SDNC-CSIT] Run tests optional in docker container 39/121539/4
authordemskeq8 <alexander.dehn@highstreet-technologies.com>
Tue, 25 May 2021 16:25:10 +0000 (18:25 +0200)
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Thu, 17 Jun 2021 15:20:48 +0000 (15:20 +0000)
Define alternative robot-framework docker image in env ROBOT_IMAGE

Issue-ID: TEST-314
Signed-off-by: demskeq8 <alexander.dehn@highstreet-technologies.com>
Change-Id: Ie3ebc85e32d0e429db55604f862c46abc9c27cee

Former-commit-id: 10ec243ccd7f33857b855f7bfd549e2c3cb4b640

csit/run-csit.sh

index e7cb005..eb255e9 100755 (executable)
@@ -2,6 +2,7 @@
 #
 # Copyright 2016-2017 Huawei Technologies Co., Ltd.
 # Modification Copyright 2019-2021 © Samsung Electronics Co., Ltd.
+# Modification Copyright 2021 © highstreet-technologies GmbH
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -192,9 +193,19 @@ SUITES=$( xargs -a testplan.txt )
 echo ROBOT_VARIABLES="${ROBOT_VARIABLES}"
 echo "Starting Robot test suites ${SUITES} ..."
 relax_set
-echo "*** TRACE **** python is $(which python) [version $(python --version)]"
-env
-python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}
+
+# Runs an alternative robotframework setup as docker image in $ROBOT_IMAGE
+# test suites will be executed within this docker container
+# and results are stored as usual
+if [[ -z $ROBOT_IMAGE ]]; then
+    echo "*** TRACE **** python is $(which python) [version $(python --version)]"
+    env
+    python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}
+else
+    echo "*** TRACE **** python is running in a container"
+    docker run --net="host" -v ${WORKSPACE}:${WORKSPACE} -v ${WORKDIR}:${WORKDIR} $ROBOT_IMAGE  \
+    python -B -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp --outputdir ${WORKDIR} ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}
+fi
 RESULT=$?
 load_set
 echo "RESULT: $RESULT"