X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fcommon%2Frapp_catalogue_api_functions.sh;h=254883eb8ac1014d1092b9ff09df0ec91a819e5a;hb=02a72fd14966d3a7f26e6ef93f1a045607348f14;hp=777b9d372648acd7f7a47129d4bc554cd92a21a9;hpb=4f7f0cda2f07f62dcbb2e371fc09764b2337a8e9;p=nonrtric.git diff --git a/test/common/rapp_catalogue_api_functions.sh b/test/common/rapp_catalogue_api_functions.sh index 777b9d37..254883eb 100644 --- a/test/common/rapp_catalogue_api_functions.sh +++ b/test/common/rapp_catalogue_api_functions.sh @@ -19,6 +19,63 @@ # This is a script that contains container/service managemnt functions test functions for RAPP Catalogue API +################ Test engine functions ################ + +# Create the image var used during the test +# arg: [] (selects staging, snapshot, release etc) +# 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" +} + +# Pull image from remote repo or use locally built image +# arg: +# Shall be used for images allowing overriding. For example use a local image when test is started to use released images +# 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 +} + +# Generate a string for each included image using the app display name and a docker images format string +# If a custom image repo is used then also the source image from the local repo is listed +# arg: +__RC_image_data() { + echo -e "$RAPP_CAT_DISPLAY_NAME\t$(docker images --format $1 $RAPP_CAT_IMAGE)" >> $2 + if [ ! -z "$RAPP_CAT_IMAGE_SOURCE" ]; then + echo -e "-- source image --\t$(docker images --format $1 $RAPP_CAT_IMAGE_SOURCE)" >> $2 + fi +} + +# Scale kubernetes resources to zero +# All resources shall be ordered to be scaled to 0, if relevant. If not relevant to scale, then do no action. +# This function is called for apps fully managed by the test script +__RC_kube_scale_zero() { + __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RC +} + +# 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. +__RC_kube_scale_zero_and_wait() { + __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-rappcatalogueservice + __kube_scale_all_resources $KUBE_NONRTRIC_NAMESPACE autotest RC +} + +# Delete all kube resouces 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 +} + +# Store docker logs +# This function is called for apps managed by the test script. +# args: +__RC_store_docker_logs() { + docker logs $RAPP_CAT_APP_NAME > $1$2_rc.log 2>&1 +} + +####################################################### + ## Access to RAPP Catalogue # Host name may be changed if app started by kube # Direct access from script @@ -154,7 +211,9 @@ start_rapp_catalogue() { export RAPP_CAT_EXTERNAL_SECURE_PORT export DOCKER_SIM_NWNAME - __start_container $RAPP_CAT_COMPOSE_DIR NODOCKERARGS 1 $RAPP_CAT_APP_NAME + export RAPP_CAT_DISPLAY_NAME + + __start_container $RAPP_CAT_COMPOSE_DIR "" NODOCKERARGS 1 $RAPP_CAT_APP_NAME __check_service_start $RAPP_CAT_APP_NAME $RC_PATH$RAPP_CAT_ALIVE_URL fi