Merge "Updates of function test for f-release"
[nonrtric.git] / test / common / cr_api_functions.sh
index a9acd6e..40ef7ea 100644 (file)
@@ -122,11 +122,21 @@ __CR_statisics_setup() {
                        CR_INSTANCE_KUBE=$(($CR_INSTANCE-1))
                        echo -n " CR-$CR_INSTANCE_KUBE $CR_APP_NAME-$CR_INSTANCE_KUBE $KUBE_SIM_NAMESPACE "
                else
-                       echo -n " CR_$CR_INSTANCE ${CR_APP_NAME}_cr_$CR_INSTANCE "
+                       if [ $DOCKER_COMPOSE_VERION == "V1" ]; then
+                               echo -n " CR_$CR_INSTANCE ${CR_APP_NAME}_cr_$CR_INSTANCE "
+                       else
+                               echo -n " CR_$CR_INSTANCE ${CR_APP_NAME}-cr-$CR_INSTANCE "
+                       fi
                fi
        done
 }
 
+# Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied
+# args: -
+__CR_test_requirements() {
+       :
+}
+
 #######################################################
 
 ################
@@ -156,12 +166,16 @@ use_cr_https() {
 __cr_set_protocoll() {
 
        echo -e $BOLD"$CR_DISPLAY_NAME protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards $CR_DISPLAY_NAME"
+       echo -e " Using $BOLD $1 $EBOLD towards $CR_DISPLAY_NAME"
        ## Access to Dmaap adapter
        for ((CR_INSTANCE=0; CR_INSTANCE<$MAX_CR_APP_COUNT; CR_INSTANCE++ )); do
                CR_DOCKER_INSTANCE=$(($CR_INSTANCE+1))
                # CR_SERVICE_PATH is the base path to cr
-               __CR_SERVICE_PATH=$1"://"$CR_APP_NAME"_cr_"${CR_DOCKER_INSTANCE}":"$2  # docker access, container->container and script->container via proxy
+               if [ $DOCKER_COMPOSE_VERION == "V1" ]; then
+                       __CR_SERVICE_PATH=$1"://"$CR_APP_NAME"_cr_"${CR_DOCKER_INSTANCE}":"$2  # docker access, container->container and script->container via proxy
+               else
+                       __CR_SERVICE_PATH=$1"://"$CR_APP_NAME"-cr-"${CR_DOCKER_INSTANCE}":"$2  # docker access, container->container and script->container via proxy
+               fi
                if [ $RUNMODE == "KUBE" ]; then
                        __CR_SERVICE_PATH=$1"://"$CR_APP_NAME"-"$CR_INSTANCE.$CR_APP_NAME"."$KUBE_SIM_NAMESPACE":"$3 # kube access, pod->svc and script->svc via proxy
                fi
@@ -285,7 +299,11 @@ start_cr() {
                app_data=""
                cntr=1
                while [ $cntr -le $CR_APP_COUNT ]; do
-                       app=$CR_APP_NAME"_cr_"$cntr
+                       if [ $DOCKER_COMPOSE_VERION == "V1" ]; then
+                               app=$CR_APP_NAME"_cr_"$cntr
+                       else
+                               app=$CR_APP_NAME"-cr-"$cntr
+                       fi
                        app_data="$app_data $app"
                        let cntr=cntr+1
                done
@@ -297,7 +315,11 @@ start_cr() {
                cntr=1   #Counter for docker instance, starts on 1
                cntr2=0  #Couter for env var name, starts with 0 to be compablible with kube
                while [ $cntr -le $CR_APP_COUNT ]; do
-                       app=$CR_APP_NAME"_cr_"$cntr
+                       if [ $DOCKER_COMPOSE_VERION == "V1" ]; then
+                               app=$CR_APP_NAME"_cr_"$cntr
+                       else
+                               app=$CR_APP_NAME"-cr-"$cntr
+                       fi
                        __dynvar="CR_SERVICE_PATH_"$cntr2
                        __check_service_start $app ${!__dynvar}$CR_ALIVE_URL
                        let cntr=cntr+1
@@ -473,10 +495,10 @@ cr_api_check_all_sync_events() {
        return 0
 }
 
-# CR API: Check the contents of all current status events for one id from ECS
+# CR API: Check the contents of all current status events for one id from ICS
 # <response-code> <cr-path-id> <id> [ EMPTY | ( <status> )+ ]
 # (Function for test scripts)
-cr_api_check_all_ecs_events() {
+cr_api_check_all_ics_events() {
        __log_test_start $@
 
     if [ $# -lt 3 ]; then
@@ -530,10 +552,10 @@ cr_api_check_all_ecs_events() {
        return 0
 }
 
-# CR API: Check the contents of all current type subscription events for one id from ECS
+# CR API: Check the contents of all current type subscription events for one id from ICS
 # <response-code> <cr-path-id> <id> [ EMPTY | ( <type-id> <schema> <registration-status> )+ ]
 # (Function for test scripts)
-cr_api_check_all_ecs_subscription_events() {
+cr_api_check_all_ics_subscription_events() {
        __log_test_start $@
 
        #Valid number of parameter 3,4,8,12
@@ -609,7 +631,7 @@ cr_api_check_all_ecs_subscription_events() {
 cr_api_reset() {
        __log_conf_start $@
 
-       if [ $# -ne 0 ]; then
+       if [ $# -ne 1 ]; then
                __print_err "<cr-path-id>" $@
                return 1
        fi