+if [[ $SUPPORTED_RUNMODES != *"$RUNMODE"* ]]; then
+ echo -e $RED"This test script does not support RUNMODE $RUNMODE"$ERED
+ echo "Supported RUNMODEs: "$SUPPORTED_RUNMODES
+ exit 1
+fi
+
+# Choose list of included apps depending on run-mode
+if [ $RUNMODE == "KUBE" ]; then
+ INCLUDED_IMAGES=$KUBE_INCLUDED_IMAGES
+else
+ INCLUDED_IMAGES=$DOCKER_INCLUDED_IMAGES
+fi
+
+echo ""
+# auto adding system apps
+echo -e $BOLD"Auto adding system apps"$EBOLD
+if [ $RUNMODE == "KUBE" ]; then
+ INCLUDED_IMAGES=$INCLUDED_IMAGES" "$TESTENV_KUBE_SYSTEM_APPS
+ TMP_APPS=$TESTENV_KUBE_SYSTEM_APPS
+else
+ INCLUDED_IMAGES=$INCLUDED_IMAGES" "$TESTENV_DOCKER_SYSTEM_APPS
+ TMP_APPS=$TESTENV_DOCKER_SYSTEM_APPS
+fi
+if [ ! -z "$TMP_APPS" ]; then
+ for iapp in "$TMP_APPS"; do
+ file_pointer=$(echo $iapp | tr '[:upper:]' '[:lower:]')
+ file_pointer="../common/"$file_pointer"_api_functions.sh"
+ echo " Auto-adding system app $iapp. Sourcing $file_pointer"
+ . $file_pointer
+ done
+else
+ echo " None"
+fi
+echo ""
+
+# Check needed installed sw
+tmp=$(which python3)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+ echo -e $RED"python3 is required to run the test environment, pls install"$ERED
+ exit 1
+fi
+tmp=$(which docker)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+ echo -e $RED"docker is required to run the test environment, pls install"$ERED
+ exit 1
+fi
+
+tmp=$(which docker-compose)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+ if [ $RUNMODE == "DOCKER" ]; then
+ echo -e $RED"docker-compose is required to run the test environment, pls install"$ERED
+ exit 1
+ fi
+fi
+if [ $RUNMODE == "DOCKER" ]; then
+ tmp=$(docker-compose version | grep -i 'docker' | grep -i 'compose' | grep -i 'version')
+ if [[ "$tmp" == *'v2'* ]]; then
+ echo -e $RED"docker-compose is using docker-compose version 2"$ERED
+ echo -e $RED"The test environment only support version 1"$ERED
+ echo -e $RED"Disable version 2 by cmd 'docker-compose disable-v2' and re-run the script "$ERED
+ exit 1
+ fi
+fi
+
+tmp=$(which kubectl)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+ if [ $RUNMODE == "KUBE" ]; then
+ echo -e $RED"kubectl is required to run the test environment in kubernetes mode, pls install"$ERED
+ exit 1
+ fi
+else
+ if [ $RUNMODE == "KUBE" ]; then
+ res=$(kubectl cluster-info 2>&1)
+ if [ $? -ne 0 ]; then
+ echo -e "$BOLD$RED############################################# $ERED$EBOLD"
+ echo -e $BOLD$RED"Command 'kubectl cluster-info' returned error $ERED$EBOLD"
+ echo -e "$BOLD$RED############################################# $ERED$EBOLD"
+ echo " "
+ echo "kubectl response:"
+ echo $res
+ echo " "
+ echo "This script may have been started with user with no permission to run kubectl"
+ echo "Try running with 'sudo' or set 'KUBECONFIG'"
+ echo "Do either 1, 2 or 3 "
+ echo " "
+ echo "1"
+ echo "Run with sudo"
+ echo -e $BOLD"sudo <test-script-and-parameters>"$EBOLD
+ echo " "
+ echo "2"
+ echo "Export KUBECONFIG and pass env to sudo - (replace user)"
+ echo -e $BOLD"export KUBECONFIG='/home/<user>/.kube/config'"$EBOLD
+ echo -e $BOLD"sudo -E <test-script-and-parameters>"$EBOLD
+ echo " "
+ echo "3"
+ echo "Set KUBECONFIG inline (replace user)"
+ echo -e $BOLD"sudo KUBECONFIG='/home/<user>/.kube/config' <test-script-and-parameters>"$EBOLD