X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Ftestcase_common.sh;h=235b2d15c43c42435a8dd1a2f1db9b88b8e69951;hb=f81090f8f5f1fd1a76bb9feab1f41f03252297c3;hp=78f27fd2662d8ada23188d7d5d2cf334906a5b54;hpb=8fbc63697f2edaaf2c9db40f54b318e7211361e2;p=nonrtric.git diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh index 78f27fd2..235b2d15 100755 --- a/test/common/testcase_common.sh +++ b/test/common/testcase_common.sh @@ -26,7 +26,7 @@ __print_args() { echo "Args: remote|remote-remove docker|kube --env-file [release] [auto-clean] [--stop-at-error] " echo " [--ricsim-prefix ] [--use-local-image +] [--use-snapshot-image +]" - echo " [--use-staging-image +] [--use-release-image +] [--image-repo ]" + echo " [--use-staging-image +] [--use-release-image +] [--use-external-image +] [--image-repo ]" echo " [--repo-policy local|remote] [--cluster-timeout ] [--print-stats]" echo " [--override ] [--pre-clean] [--gen-stats] [--delete-namespaces]" echo " [--delete-containers] [--endpoint-stats] [--kubeconfig ] [--host-path-dir ]" @@ -55,6 +55,7 @@ if [ $# -eq 1 ] && [ "$1" == "help" ]; then echo "--use-snapshot-image - The script will use images from the nexus snapshot repo for the supplied apps, space separated list of app short names" echo "--use-staging-image - The script will use images from the nexus staging repo for the supplied apps, space separated list of app short names" echo "--use-release-image - The script will use images from the nexus release repo for the supplied apps, space separated list of app short names" + echo "--use-external-image - The script will use images from the external (non oran/onap) repo for the supplied apps, space separated list of app short names" echo "--image-repo - Url to optional image repo. Only locally built images will be re-tagged and pushed to this repo" echo "--repo-policy - Policy controlling which images to re-tag and push if param --image-repo is set. Default is 'local'" echo "--cluster-timeout - Optional timeout for cluster where it takes time to obtain external ip/host-name. Timeout in seconds. " @@ -123,6 +124,8 @@ USE_STAGING_IMAGES="" # Var to hold the app names to use remote release images for USE_RELEASE_IMAGES="" +# Var to hold the app names to use external release images for +USE_EXTERNAL_IMAGES="" # Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case STOP_AT_ERROR=0 @@ -135,7 +138,7 @@ IMAGE_CATEGORY="DEV" #Var to indicate docker-compose version, V1 or V2 #V1 names replicated containers __ #V2 names replicated containers -- -DOCKER_COMPOSE_VERION="V1" +DOCKER_COMPOSE_VERSION="V1" # Function to indent cmd output with one space indent1() { sed 's/^/ /'; } @@ -681,6 +684,31 @@ while [ $paramerror -eq 0 ] && [ $foundparm -eq 0 ]; do fi fi fi + if [ $paramerror -eq 0 ]; then + if [ "$1" == "--use-external-image" ]; then + USE_EXTERNAL_IMAGES="" + shift + while [ $# -gt 0 ] && [[ "$1" != "--"* ]]; do + USE_EXTERNAL_IMAGES=$USE_EXTERNAL_IMAGES" "$1 + if [[ "$AVAILABLE_IMAGES_OVERRIDE" != *"$1"* ]]; then + paramerror=1 + if [ -z "$paramerror_str" ]; then + paramerror_str="App name $1 is not available for release override for flag: '--use-external-image'" + fi + fi + shift; + done + foundparm=0 + if [ -z "$USE_EXTERNAL_IMAGES" ]; then + paramerror=1 + if [ -z "$paramerror_str" ]; then + paramerror_str="No app name found for flag: '--use-use-external-image'" + fi + else + echo "Option set - Overriding with external images for app(s):"$USE_EXTERNAL_IMAGES + fi + fi + fi if [ $paramerror -eq 0 ]; then if [ "$1" == "--image-repo" ]; then shift; @@ -1120,7 +1148,7 @@ if [ $RUNMODE == "DOCKER" ]; then tmp=$(docker-compose version) echo " docker-compose installed and using version $tmp" if [[ "$tmp" == *'v2'* ]]; then - DOCKER_COMPOSE_VERION="V2" + DOCKER_COMPOSE_VERSION="V2" fi fi fi @@ -1249,7 +1277,7 @@ __check_and_create_image_var() { if [ "$5" == "REMOTE_RELEASE_ORAN" ]; then image=$NEXUS_RELEASE_REPO_ORAN$image fi - #No nexus repo added for local images, tag: LOCAL + #No nexus repo added for local images, tag: LOCAL and other tags tmp=$tmp$image"\t" fi if [ -z $tag ]; then @@ -1429,6 +1457,12 @@ __check_image_override() { ((CTR++)) fi done + for im in $USE_EXTERNAL_IMAGES; do + if [ "$1" == "$im" ]; then + suffix="EXTERNAL" + ((CTR++)) + fi + done echo $suffix if [ $CTR -gt 1 ]; then exit 1 @@ -2731,6 +2765,17 @@ __clean_kube() { fi done + # Remove istio label on namespaces + test_env_namespaces=$(kubectl $KUBECONF get ns --no-headers -o custom-columns=":metadata.name" -l autotest=engine -l istio-injection=enabled) #Get list of ns created by the test env + if [ $? -ne 0 ]; then + echo " Cannot get list of namespaces...continues.." + else + for test_env_ns in $test_env_namespaces; do + echo " Removing istio label on ns: "$test_env_ns + __kube_label_non_ns_instance ns $test_env_ns "istio-injection-" + done + fi + echo "" } @@ -2853,7 +2898,7 @@ __start_container() { envsubst < $compose_file > "gen_"$compose_file compose_file="gen_"$compose_file - if [ $DOCKER_COMPOSE_VERION == "V1" ]; then + if [ $DOCKER_COMPOSE_VERSION == "V1" ]; then docker_compose_cmd="docker-compose" else docker_compose_cmd="docker compose"