Modify sme invoker to discover the endpoints by itself
[nonrtric.git] / test / common / rc_api_functions.sh
index 537bc0c..bb085d6 100644 (file)
@@ -17,7 +17,7 @@
 #  ============LICENSE_END=================================================
 #
 
-# This is a script that contains container/service managemnt functions test functions for RAPP Catalogue API
+# This is a script that contains container/service management functions test functions for RAPP Catalogue API
 
 ################ Test engine functions ################
 
@@ -25,7 +25,7 @@
 # arg: [<image-tag-suffix>] (selects staging, snapshot, release etc)
 # <image-tag-suffix> is present only for images with staging, snapshot,release tags
 __RC_imagesetup() {
-       __check_and_create_image_var RC "RAPP_CAT_IMAGE" "RAPP_CAT_IMAGE_BASE" "RAPP_CAT_IMAGE_TAG" $1 "$RAPP_CAT_DISPLAY_NAME"
+       __check_and_create_image_var RC "RAPP_CAT_IMAGE" "RAPP_CAT_IMAGE_BASE" "RAPP_CAT_IMAGE_TAG" $1 "$RAPP_CAT_DISPLAY_NAME" ""
 }
 
 # Pull image from remote repo or use locally built image
@@ -34,7 +34,7 @@ __RC_imagesetup() {
 # <pull-policy-original> Shall be used for images that does not allow overriding
 # Both arg var may contain: 'remote', 'remote-remove' or 'local'
 __RC_imagepull() {
-       __check_and_pull_image $1 "$c" $RAPP_CAT_APP_NAME RAPP_CAT_IMAGE
+       __check_and_pull_image $1 "$RAPP_CAT_DISPLAY_NAME" $RAPP_CAT_APP_NAME RAPP_CAT_IMAGE
 }
 
 # Generate a string for each included image using the app display name and a docker images format string
@@ -55,12 +55,12 @@ __RC_kube_scale_zero() {
 }
 
 # Scale kubernetes resources to zero and wait until this has been accomplished, if relevant. If not relevant to scale, then do no action.
-# This function is called for prestarted apps not managed by the test script.
+# This function is called for pre-started apps not managed by the test script.
 __RC_kube_scale_zero_and_wait() {
        __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app "$KUBE_NONRTRIC_NAMESPACE"-rappcatalogueservice
 }
 
-# Delete all kube resouces for the app
+# Delete all kube resources for the app
 # This function is called for apps managed by the test script.
 __RC_kube_delete_all() {
        __kube_delete_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RC
@@ -68,10 +68,10 @@ __RC_kube_delete_all() {
 
 # Store docker logs
 # This function is called for apps managed by the test script.
-# args: <log-dir> <file-prexix>
+# args: <log-dir> <file-prefix>
 __RC_store_docker_logs() {
        if [ $RUNMODE == "KUBE" ]; then
-               kubectl  logs -l "autotest=RC" -n $KUBE_NONRTRIC_NAMESPACE --tail=-1 > $1$2_rc.log 2>&1
+               kubectl $KUBECONF  logs -l "autotest=RC" -n $KUBE_NONRTRIC_NAMESPACE --tail=-1 > $1$2_rc.log 2>&1
        else
                docker logs $RAPP_CAT_APP_NAME > $1$2_rc.log 2>&1
        fi
@@ -84,11 +84,11 @@ __RC_initial_setup() {
        use_rapp_catalogue_http
 }
 
-# Set app short-name, app name and namespace for logging runtime statistics of kubernets pods or docker containers
+# Set app short-name, app name and namespace for logging runtime statistics of kubernetes pods or docker containers
 # For docker, the namespace shall be excluded
-# This function is called for apps managed by the test script as well as for prestarted apps.
+# This function is called for apps managed by the test script as well as for pre-started apps.
 # args: -
-__RC_statisics_setup() {
+__RC_statistics_setup() {
        if [ $RUNMODE == "KUBE" ]; then
                echo "RC $RAPP_CAT_APP_NAME $KUBE_NONRTRIC_NAMESPACE"
        else
@@ -96,6 +96,12 @@ __RC_statisics_setup() {
        fi
 }
 
+# Check application requirements, e.g. helm, the the test needs. Exit 1 if req not satisfied
+# args: -
+__RC_test_requirements() {
+       :
+}
+
 #######################################################
 
 # Set http as the protocol to use for all communication to the Rapp catalogue
@@ -116,7 +122,7 @@ use_rapp_catalogue_https() {
 # args: <protocol> <internal-port> <external-port>
 __rapp_catalogue_set_protocoll() {
        echo -e $BOLD"$RAPP_CAT_DISPLAY_NAME protocol setting"$EBOLD
-       echo -e " Using $BOLD http $EBOLD towards $RAPP_CAT_DISPLAY_NAME"
+       echo -e " Using $BOLD $1 $EBOLD towards $RAPP_CAT_DISPLAY_NAME"
 
        ## Access to Rapp catalogue
 
@@ -162,7 +168,7 @@ start_rapp_catalogue() {
                __check_included_image "RC"
                retcode_i=$?
 
-               # Check if app shall only be used by the testscipt
+               # Check if app shall only be used by the test script
                __check_prestarted_image "RC"
                retcode_p=$?
 
@@ -234,7 +240,7 @@ rc_equal() {
                #__var_test RC "$LOCALHOST_HTTP:$RC_EXTERNAL_PORT/" $1 "=" $2 $3
                __var_test RC "$RC_SERVICE_PATH/" $1 "=" $2 $3
        else
-               __print_err "Wrong args to ecs_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
+               __print_err "Wrong args to ics_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
        fi
 }