# 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.
__ECS_kube_scale_zero_and_wait() {
- __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app nonrtric-enrichmentservice
+ __kube_scale_and_wait_all_resources $KUBE_NONRTRIC_NAMESPACE app "$KUBE_NONRTRIC_NAMESPACE"-enrichmentservice
}
# Delete all kube resouces for the app
# This function is called for apps managed by the test script.
# args: <log-dir> <file-prexix>
__ECS_store_docker_logs() {
- docker logs $ECS_APP_NAME > $1$2_ecs.log 2>&1
+ if [ $RUNMODE == "KUBE" ]; then
+ kubectl logs -l "autotest=ECS" -n $KUBE_NONRTRIC_NAMESPACE --tail=-1 > $1$2_ecs.log 2>&1
+ else
+ docker logs $ECS_APP_NAME > $1$2_ecs.log 2>&1
+ fi
}
-#######################################################
+# Initial setup of protocol, host and ports
+# This function is called for apps managed by the test script.
+# args: -
+__ECS_initial_setup() {
+ use_ecs_rest_http
+}
-## Access to ECS
-# Host name may be changed if app started by kube
-# Direct access
-ECS_HTTPX="http"
-ECS_HOST_NAME=$LOCALHOST_NAME
-ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
+# Set app short-name, app name and namespace for logging runtime statistics of kubernets 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.
+# args: -
+__ECS_statisics_setup() {
+ if [ $RUNMODE == "KUBE" ]; then
+ echo "ECS $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE"
+ else
+ echo "ECS $ECS_APP_NAME"
+ fi
+}
+
+#######################################################
-# ECS_ADAPTER used for switch between REST and DMAAP (only REST supported currently)
-ECS_ADAPTER_TYPE="REST"
-ECS_ADAPTER=$ECS_PATH
# Make curl retries towards ECS for http response codes set in this env var, space separated list of codes
ECS_RETRY_CODES=""
# args: -
# (Function for test scripts)
use_ecs_rest_http() {
- echo -e $BOLD"ECS protocol setting"$EBOLD
- echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
- ECS_HTTPX="http"
- ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
-
- ECS_ADAPTER_TYPE="REST"
- ECS_ADAPTER=$ECS_PATH
- echo ""
+ __ecs_set_protocoll "http" $ECS_INTERNAL_PORT $ECS_EXTERNAL_PORT
}
# All calls to ECS will be directed to the ECS REST interface from now on
# args: -
# (Function for test scripts)
use_ecs_rest_https() {
- echo -e $BOLD"ECS protocol setting"$EBOLD
- echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
- ECS_HTTPX="https"
- ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
-
- ECS_ADAPTER_TYPE="REST"
- ECS_ADAPTER=$ECS_PATH
- echo ""
+ __ecs_set_protocoll "https" $ECS_INTERNAL_SECURE_PORT $ECS_EXTERNAL_SECURE_PORT
}
# All calls to ECS will be directed to the ECS dmaap interface over http from now on
echo ""
}
-# All calls to ECS will be directed to the ECS dmaap interface over https from now on
-# args: -
-# (Function for test scripts)
-use_ecs_dmaap_https() {
- echo -e $BOLD"RICSIM protocol setting"$EBOLD
- echo -e $RED" - NOT SUPPORTED - "$ERED
- echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
- ECS_ADAPTER_TYPE="MR-HTTPS"
+# Setup paths to svc/container for internal and external access
+# args: <protocol> <internal-port> <external-port>
+__ecs_set_protocoll() {
+ echo -e $BOLD"$ECS_DISPLAY_NAME protocol setting"$EBOLD
+ echo -e " Using $BOLD http $EBOLD towards $ECS_DISPLAY_NAME"
+
+ ## Access to ECS
+
+ ECS_SERVICE_PATH=$1"://"$ECS_APP_NAME":"$2 # docker access, container->container and script->container via proxy
+ if [ $RUNMODE == "KUBE" ]; then
+ ECS_SERVICE_PATH=$1"://"$ECS_APP_NAME.$KUBE_NONRTRIC_NAMESPACE":"$3 # kube access, pod->svc and script->svc via proxy
+ fi
+
+ # ECS_ADAPTER used for switching between REST and DMAAP (only REST supported currently)
+ ECS_ADAPTER_TYPE="REST"
+ ECS_ADAPTER=$ECS_SERVICE_PATH
+
echo ""
}
+# Export env vars for config files, docker compose and kube resources
+# args: PROXY|NOPROXY
+__ecs_export_vars() {
+ export ECS_APP_NAME
+ export ECS_APP_NAME_ALIAS
+ export KUBE_NONRTRIC_NAMESPACE
+ export ECS_IMAGE
+ export ECS_INTERNAL_PORT
+ export ECS_INTERNAL_SECURE_PORT
+ export ECS_EXTERNAL_PORT
+ export ECS_EXTERNAL_SECURE_PORT
+ export ECS_CONFIG_MOUNT_PATH
+ export ECS_CONFIG_CONFIGMAP_NAME=$ECS_APP_NAME"-config"
+ export ECS_DATA_CONFIGMAP_NAME=$ECS_APP_NAME"-data"
+ export ECS_CONTAINER_MNT_DIR
+ export ECS_HOST_MNT_DIR
+ export ECS_CONFIG_FILE
+ export DOCKER_SIM_NWNAME
+ export ECS_DISPLAY_NAME
+
+
+ export ECS_DATA_PV_NAME=$ECS_APP_NAME"-pv"
+ export ECS_DATA_PVC_NAME=$ECS_APP_NAME"-pvc"
+ #Create a unique path for the pv each time to prevent a previous volume to be reused
+ export ECS_PV_PATH="ecsdata-"$(date +%s)
+
+ if [ $1 == "PROXY" ]; then
+ export ECS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
+ export ECS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
+ if [ $ECS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$ECS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
+ echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
+ else
+ echo " Configured with http proxy"
+ fi
+ else
+ export ECS_HTTP_PROXY_CONFIG_PORT=0
+ export ECS_HTTP_PROXY_CONFIG_HOST_NAME=""
+ echo " Configured without http proxy"
+ fi
+}
+
+
# Start the ECS
# args: PROXY|NOPROXY <config-file>
# (Function for test scripts)
#Check if nonrtric namespace exists, if not create it
__kube_create_namespace $KUBE_NONRTRIC_NAMESPACE
- export ECS_APP_NAME
- export KUBE_NONRTRIC_NAMESPACE
- export ECS_IMAGE
- export ECS_INTERNAL_PORT
- export ECS_INTERNAL_SECURE_PORT
- export ECS_EXTERNAL_PORT
- export ECS_EXTERNAL_SECURE_PORT
- export ECS_CONFIG_MOUNT_PATH
- export ECS_CONFIG_CONFIGMAP_NAME=$ECS_APP_NAME"-config"
- export ECS_DATA_CONFIGMAP_NAME=$ECS_APP_NAME"-data"
- export ECS_CONTAINER_MNT_DIR
-
- export ECS_DATA_PV_NAME=$ECS_APP_NAME"-pv"
- export ECS_DATA_PVC_NAME=$ECS_APP_NAME"-pvc"
- #Create a unique path for the pv each time to prevent a previous volume to be reused
- export ECS_PV_PATH="ecsdata-"$(date +%s)
-
- if [ $1 == "PROXY" ]; then
- ECS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
- ECS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
- if [ $ECS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$ECS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
- echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
- else
- echo " Configured with http proxy"
- fi
- else
- ECS_HTTP_PROXY_CONFIG_PORT=0
- ECS_HTTP_PROXY_CONFIG_HOST_NAME=""
- echo " Configured without http proxy"
- fi
- export ECS_HTTP_PROXY_CONFIG_PORT
- export ECS_HTTP_PROXY_CONFIG_HOST_NAME
+ __ecs_export_vars $1
# Create config map for config
datafile=$PWD/tmp/$ECS_CONFIG_FILE
echo -e $YELLOW" Persistency may not work for app $ECS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
fi
- echo " Retrieving host and ports for service..."
- ECS_HOST_NAME=$(__kube_get_service_host $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
- ECS_EXTERNAL_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "http")
- ECS_EXTERNAL_SECURE_PORT=$(__kube_get_service_port $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE "https")
-
- echo " Host IP, http port, https port: $ECS_HOST_NAME $ECS_EXTERNAL_PORT $ECS_EXTERNAL_SECURE_PORT"
- if [ $ECS_HTTPX == "http" ]; then
- ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_PORT
- else
- ECS_PATH=$ECS_HTTPX"://"$ECS_HOST_NAME":"$ECS_EXTERNAL_SECURE_PORT
- fi
+ __check_service_start $ECS_APP_NAME $ECS_SERVICE_PATH$ECS_ALIVE_URL
- __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
-
- if [ $ECS_ADAPTER_TYPE == "REST" ]; then
- ECS_ADAPTER=$ECS_PATH
- fi
else
__check_included_image 'ECS'
if [ $? -eq 1 ]; then
else
echo " No files in mounted dir or dir does not exists"
fi
+
cd $curdir
- export ECS_APP_NAME
- export ECS_APP_NAME_ALIAS
- export ECS_HOST_MNT_DIR
- export ECS_CONTAINER_MNT_DIR
- export ECS_CONFIG_MOUNT_PATH
- export ECS_CONFIG_FILE
- export ECS_INTERNAL_PORT
- export ECS_EXTERNAL_PORT
- export ECS_INTERNAL_SECURE_PORT
- export ECS_EXTERNAL_SECURE_PORT
- export DOCKER_SIM_NWNAME
- export ECS_DISPLAY_NAME
-
- if [ $1 == "PROXY" ]; then
- ECS_HTTP_PROXY_CONFIG_PORT=$HTTP_PROXY_CONFIG_PORT #Set if proxy is started
- ECS_HTTP_PROXY_CONFIG_HOST_NAME=$HTTP_PROXY_CONFIG_HOST_NAME #Set if proxy is started
- if [ $ECS_HTTP_PROXY_CONFIG_PORT -eq 0 ] || [ -z "$ECS_HTTP_PROXY_CONFIG_HOST_NAME" ]; then
- echo -e $YELLOW" Warning: HTTP PROXY will not be configured, proxy app not started"$EYELLOW
- else
- echo " Configured with http proxy"
- fi
- else
- ECS_HTTP_PROXY_CONFIG_PORT=0
- ECS_HTTP_PROXY_CONFIG_HOST_NAME=""
- echo " Configured without http proxy"
- fi
- export ECS_HTTP_PROXY_CONFIG_PORT
- export ECS_HTTP_PROXY_CONFIG_HOST_NAME
+ __ecs_export_vars $1
dest_file=$SIM_GROUP/$ECS_COMPOSE_DIR/$ECS_HOST_MNT_DIR/$ECS_CONFIG_FILE
__start_container $ECS_COMPOSE_DIR "" NODOCKERARGS 1 $ECS_APP_NAME
- __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
+ __check_service_start $ECS_APP_NAME $ECS_SERVICE_PATH$ECS_ALIVE_URL
fi
echo ""
return 0
echo -e $YELLOW" Persistency may not work for app $ECS_APP_NAME in multi-worker node config when running it as a prestarted app"$EYELLOW
res_type=$(__kube_get_resource_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE)
__kube_scale $res_type $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE 1
- __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
+ __check_service_start $ECS_APP_NAME $ECS_SERVICE_PATH$ECS_ALIVE_URL
return 0
fi
return 1
fi
fi
- __check_service_start $ECS_APP_NAME $ECS_PATH$ECS_ALIVE_URL
+ __check_service_start $ECS_APP_NAME $ECS_SERVICE_PATH$ECS_ALIVE_URL
if [ $? -ne 0 ]; then
return 1
fi
# (Function for test scripts)
set_ecs_debug() {
echo -e $BOLD"Setting ecs debug logging"$EBOLD
- curlString="$ECS_PATH$ECS_ACTUATOR -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
+ curlString="$ECS_SERVICE_PATH$ECS_ACTUATOR -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
result=$(__do_curl "$curlString")
if [ $? -ne 0 ]; then
__print_err "Could not set debug mode" $@
# (Function for test scripts)
set_ecs_trace() {
echo -e $BOLD"Setting ecs trace logging"$EBOLD
- curlString="$ECS_PATH/actuator/loggers/org.oransc.enrichment -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
+ curlString="$ECS_SERVICE_PATH/actuator/loggers/org.oransc.enrichment -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
result=$(__do_curl "$curlString")
if [ $? -ne 0 ]; then
__print_err "Could not set trace mode" $@
# (Function for test scripts)
ecs_equal() {
if [ $# -eq 2 ] || [ $# -eq 3 ]; then
- __var_test ECS "$ECS_PATH/" $1 "=" $2 $3
+ __var_test ECS "$ECS_SERVICE_PATH/" $1 "=" $2 $3
else
__print_err "Wrong args to ecs_equal, needs two or three args: <sim-param> <target-value> [ timeout ]" $@
fi
# API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
# API Test function: GET /data-producer/v1/info-types/{infoTypeId}
-# args: (v1_2) <response-code> <type-id> [<job-schema-file> ]
+# args: (v1_2) <response-code> <type-id> [<job-schema-file> [ <info-type-info> ]]
# (Function for test scripts)
ecs_api_edp_get_type_2() {
__log_test_start $@
if [ $# -eq 3 ]; then
paramError=0
fi
+ if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then
+ if [ $# -eq 4 ]; then
+ paramError=0
+ fi
+ fi
if [ $paramError -ne 0 ]; then
- __print_err "<response-code> <type-id> [<job-schema-file> ]" $@
+ __print_err "<response-code> <type-id> [<job-schema-file> [ <info-type-info> ]]" $@
return 1
fi
if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
__log_test_fail_status_code $1 $status
return 1
fi
- if [ $# -eq 3 ]; then
+ if [ $# -ge 3 ]; then
body=${res:0:${#res}-3}
if [ -f $3 ]; then
__log_test_fail_general "Job template file "$3", does not exist"
return 1
fi
+ info_data=""
+ if [ $# -gt 3 ]; then
+ if [ -f $4 ]; then
+ info_data=$(cat $4)
+ else
+ __log_test_fail_general "Info-data file "$4", does not exist"
+ return 1
+ fi
+ info_data=",\"info_type_information\":$info_data"
+ fi
if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
- targetJson="{\"info_job_data_schema\":$schema}"
+ targetJson="{\"info_job_data_schema\":$schema $info_data}"
else
targetJson="{\"ei_job_data_schema\":$schema}"
fi
# API Test function: PUT /ei-producer/v1/eitypes/{eiTypeId}
# API Test function: PUT /data-producer/v1/info-types/{infoTypeId}
-# args: (v1_2) <response-code> <type-id> <job-schema-file>
+# args: (v1_2) <response-code> <type-id> <job-schema-file> [ <info-type-info> ]
# (Function for test scripts)
ecs_api_edp_put_type_2() {
__log_test_start $@
- if [ $# -ne 3 ]; then
- __print_err "<response-code> <type-id> <job-schema-file>" $@
- return 1
+ if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPE-INFO"* ]]; then
+ if [ $# -lt 3 ] || [ $# -gt 4 ]; then
+ __print_err "<response-code> <type-id> <job-schema-file> [ <info-type-info> ]" $@
+ return 1
+ fi
+ else
+ if [ $# -ne 3 ]; then
+ __print_err "<response-code> <type-id> <job-schema-file>" $@
+ return 1
+ fi
fi
if [ ! -f $3 ]; then
__log_test_fail_general "Job schema file "$3", does not exist"
return 1
fi
+
+ info_data=""
+ if [ $# -gt 3 ]; then
+ if [ -f $4 ]; then
+ info_data=$(cat $4)
+ else
+ __log_test_fail_general "Info-data file "$4", does not exist"
+ return 1
+ fi
+ info_data=",\"info_type_information\":$info_data"
+ fi
+
if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
schema=$(cat $3)
- input_json="{\"info_job_data_schema\":$schema}"
+ input_json="{\"info_job_data_schema\":$schema $info_data}"
file="./tmp/put_type.json"
echo $input_json > $file
}
# API Test function: GET /data-consumer/v1/info-types/{infoTypeId}
-# args: <response-code> <type-id> [<schema-file>]
+# args: <response-code> <type-id> [<schema-file> [<type-status> <producers-count]]
# (Function for test scripts)
ecs_api_idc_get_type() {
__log_test_start $@
- if [ $# -lt 2 ] || [ $# -gt 3 ]; then
- __print_err "<response-code> <type-id> [<schema-file>]" $@
+ if [ $# -lt 2 ] || [ $# -gt 5 ]; then
+ __print_err "<response-code> <type-id> [<schema-file> [<type-status> <producers-count]]" $@
return 1
fi
return 1
fi
- if [ $# -eq 3 ]; then
+ if [ $# -gt 2 ]; then
body=${res:0:${#res}-3}
if [ -f $3 ]; then
schema=$(cat $3)
__log_test_fail_general "Schema file "$3", does not exist"
return 1
fi
- targetJson="{\"job_data_schema\":$schema}"
+ if [ $# -eq 5 ]; then
+ targetJson="{\"job_data_schema\":$schema, \"type_status\":\"$4\", \"no_of_producers\":$5}"
+ else
+ targetJson="{\"job_data_schema\":$schema}"
+ fi
echo " TARGET JSON: $targetJson" >> $HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
return 0
}
+##########################################
+#### Type subscriptions ####
+##########################################
+
+# API Test function: GET /data-consumer/v1/info-type-subscription
+# args: <response-code> <owner-id>|NOOWNER [ EMPTY | <subscription-id>+]
+# (Function for test scripts)
+ecs_api_idc_get_subscription_ids() {
+ __log_test_start $@
+
+ if [ $# -lt 3 ]; then
+ __print_err "<response-code> <owner-id>|NOOWNER [ EMPTY | <subscription-id>+]" $@
+ return 1
+ fi
+
+ query="/data-consumer/v1/info-type-subscription"
+ search=""
+ if [ $2 != "NOOWNER" ]; then
+ search="?owner="$2
+ fi
+
+ res="$(__do_curl_to_api ECS GET $query$search)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ if [ $# -gt 2 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="["
+ if [ $3 != "EMPTY" ]; then
+ for pid in ${@:3} ; do
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ targetJson=$targetJson"\"$pid\""
+ done
+ fi
+ targetJson=$targetJson"]"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: GET /data-consumer/v1/info-type-subscription/{subscriptionId}
+# args: <response-code> <subscription-id> [ <owner-id> <status-uri> ]
+# (Function for test scripts)
+ecs_api_idc_get_subscription() {
+ __log_test_start $@
+
+ if [ $# -ne 2 ] && [ $# -ne 4 ]; then
+ __print_err "<response-code> <subscription-id> [ <owner-id> <status-uri> ]" $@
+ return 1
+ fi
+
+ query="/data-consumer/v1/info-type-subscription/$2"
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ if [ $# -gt 2 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="{\"owner\":\"$3\",\"status_result_uri\":\"$4\"}"
+ echo " TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: PUT /data-consumer/v1/info-type-subscription/{subscriptionId}
+# args: <response-code> <subscription-id> <owner-id> <status-uri>
+# (Function for test scripts)
+ecs_api_idc_put_subscription() {
+ __log_test_start $@
+
+ if [ $# -ne 4 ]; then
+ __print_err "<response-code> <subscription-id> <owner-id> <status-uri>" $@
+ return 1
+ fi
+
+ inputJson="{\"owner\": \"$3\",\"status_result_uri\": \"$4\"}"
+ file="./tmp/.p.json"
+ echo "$inputJson" > $file
+
+ query="/data-consumer/v1/info-type-subscription/$2"
+ res="$(__do_curl_to_api ECS PUT $query $file)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: DELETE /data-consumer/v1/info-type-subscription/{subscriptionId}
+# args: <response-code> <subscription-id>
+# (Function for test scripts)
+ecs_api_idc_delete_subscription() {
+ __log_test_start $@
+
+ if [ $# -ne 2 ]; then
+ __print_err "<response-code> <subscription-id> " $@
+ return 1
+ fi
+
+ query="/data-consumer/v1/info-type-subscription/$2"
+ res="$(__do_curl_to_api ECS DELETE $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ __log_test_pass
+ return 0
+}
+
##########################################
#### Reset jobs ####
##########################################
ecs_kube_pvc_reset() {
__log_test_start $@
- pvc_name=$(kubectl get pvc -n nonrtric --no-headers -o custom-columns=":metadata.name" | grep enrichment)
+ pvc_name=$(kubectl get pvc -n $KUBE_NONRTRIC_NAMESPACE --no-headers -o custom-columns=":metadata.name" | grep enrichment)
if [ -z "$pvc_name" ]; then
pvc_name=enrichmentservice-pvc
fi
echo " Trying to reset pvc: "$pvc_name
- __kube_clean_pvc $ECS_APP_NAME nonrtric $pvc_name /var/enrichment-coordinator-service/database
+ __kube_clean_pvc $ECS_APP_NAME $KUBE_NONRTRIC_NAMESPACE $pvc_name $ECS_CONTAINER_MNT_DIR
__log_test_pass
return 0