3 # Modifications copyright (C) 2021 Nokia. All rights reserved
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
12 . ../common/test_env.sh
16 echo "Test case started as: ${BASH_SOURCE[$i+1]} "$1 $2
18 # Script containing all functions needed for auto testing of test cases
19 # Arg: local [<image-tag>] ]| remote [<image-tag>] ]| remote-remove [<image-tag>]] | manual-container | manual-app
21 STARTED_DFCS="" #DFC app names added to this var to keep track of started container in the script
26 if [[ "$2" =~ ^1.1.* ]]; then
27 echo "This version of auto-test does not support DFC image version of 1.1.X"
33 if [ $# -lt 1 ] || [ $# -gt 2 ]; then
34 echo "Expected arg: local [<image-tag>] ]| remote [<image-tag>] ]| remote-remove [<image-tag>]] | manual-container | manual-app"
36 elif [ $1 == "local" ]; then
37 if [ -z $DFC_LOCAL_IMAGE ]; then
38 echo "DFC_LOCAL_IMAGE not set in test_env"
41 DFC_IMAGE=$DFC_LOCAL_IMAGE":"$IMAGE_TAG
42 elif [ $1 == "remote" ] || [ $1 == "remote-remove" ]; then
43 if [ -z $DFC_REMOTE_IMAGE ]; then
44 echo "DFC_REMOTE_IMAGE not set in test_env"
47 DFC_IMAGE=$DFC_REMOTE_IMAGE":"$IMAGE_TAG
48 elif [ $1 == "manual-container" ] && [ $# -eq 1 ]; then
49 echo "DFC is expected to be started manually, when prompted, as a container with name 'dfc_app'<index> with and index in the range from 0 to '${DFC_MAX_IDX}'"
50 elif [ $1 == "manual-app" ] && [ $# -eq 1 ]; then
51 echo "DFC is expected to be started manually, when prompted, as a java application"
53 echo "Expected arg: local [<image-tag>] ]| remote [<image-tag>] ]| remote-remove [<image-tag>]] | manual-container | manual-app"
57 # Set a description string for the test case
58 if [ -z "$TC_ONELINE_DESCR" ]; then
59 TC_ONELINE_DESCR="<no-description>"
60 echo "No test case description found, TC_ONELINE_DESCR should be set on in the test script , using "$TC_ONELINE_DESCR
63 # Counter for test suites
64 if [ -f .tmp_tcsuite_ctr ]; then
65 tmpval=$(< .tmp_tcsuite_ctr)
67 echo $tmpval > .tmp_tcsuite_ctr
70 # Create a test case id, ATC (Auto Test Case), from the name of the test case script.
71 # FTC1.sh -> ATC == FTC1
72 ATC=$(basename "${BASH_SOURCE[$i+1]}" .sh)
74 # Create the logs dir if not already created in the current dir
75 if [ ! -d "logs" ]; then
81 # Create a log dir for the test case
82 mkdir -p $TESTLOGS/$ATC
84 # Clear the log dir for the test case
85 rm $TESTLOGS/$ATC/*.log &> /dev/null
87 # Log all output from the test case to a TC log
88 TCLOG=$TESTLOGS/$ATC/TC.log
89 exec &> >(tee ${TCLOG})
91 #Variables for counting tests as well as passed and failed tests
97 echo "-------------------------------------------------------------------------------------------------"
98 echo "----------------------------------- Test case: "$ATC
99 echo "----------------------------------- Started: "$(date)
100 echo "-------------------------------------------------------------------------------------------------"
101 echo "-- Description: "$TC_ONELINE_DESCR
102 echo "-------------------------------------------------------------------------------------------------"
103 echo "----------------------------------- Test case setup -----------------------------------"
105 if [ -z "$SIM_GROUP" ]; then
106 SIM_GROUP=$PWD/../simulator-group
107 if [ ! -d $SIM_GROUP ]; then
108 echo "Trying to set env var SIM_GROUP to dir 'simulator-group' in the integration repo, but failed."
109 echo "Please set the SIM_GROUP manually in the test_env.sh"
112 echo "SIM_GROUP auto set to: " $SIM_GROUP
114 elif [ $SIM_GROUP = *simulator_group ]; then
115 echo "Env var SIM_GROUP does not seem to point to dir 'simulator-group' in the integration repo, check test_env.sh"
121 if [ $1 != "manual-container" ] && [ $1 != "manual-app" ]; then
122 echo -e "DFC image tag set to: \033[1m" $IMAGE_TAG"\033[0m"
123 echo "Configured image for DFC app(s) (${1}): "$DFC_IMAGE
124 tmp_im=$(docker images ${DFC_IMAGE} | grep -v REPOSITORY)
126 if [ $1 == "local" ]; then
127 if [ -z "$tmp_im" ]; then
128 echo "Local image (non nexus) "$DFC_IMAGE" does not exist in local registry, need to be built"
131 echo -e "DFC local image: \033[1m"$tmp_im"\033[0m"
132 echo "If the DFC image seem outdated, rebuild the image and run the test again."
134 elif [ $1 == "remote" ] || [ $1 == "remote-remove" ]; then
136 if [ $1 == "remote-remove" ]; then
137 echo "Attempt to stop dfc_app container(s) if running"
138 docker stop $(docker ps -q --filter name=${DFC_APP_BASE}]) &> /dev/null
139 docker rm $(docker ps -q --filter name=${DFC_APP_BASE}) &> /dev/null
140 docker rmi $DFC_IMAGE &> /dev/null
143 if [ -z "$tmp_im" ]; then
144 echo "Pulling DFC image from nexus: "$DFC_IMAGE
145 docker pull $DFC_IMAGE > /dev/null
146 tmp_im=$(docker images ${DFC_IMAGE} | grep -v REPOSITORY)
147 if [ -z "$tmp_im" ]; then
148 echo "Image could not be pulled"
151 echo -e "DFC image: \033[1m"$tmp_im"\033[0m"
153 echo -e "DFC image: \033[1m"$tmp_im"\033[0m"
154 echo "!! If the dfc image seem outdated, consider removing it from your docker registry and run the test again. Or run the script with 'remote-remove'"
163 echo "Building images for the simulators if needed, MR, DR, DR Redir and FTPES."
164 echo "For HTTP simulator prebuilt containers exist in nexus repo."
168 docker build -t drsim_common:latest . &> /dev/null
170 docker build -t mrsim:latest . &> /dev/null
171 cd ../ftpes-sftp-server
172 docker build -t ftpes_vsftpd:latest -f Dockerfile-ftpes . &> /dev/null
177 echo "Local registry images for simulators:"
178 echo "MR simulator " $(docker images | grep mrsim)
179 echo "DR simulator: " $(docker images | grep drsim_common)
180 echo "DR redir simulator: " $(docker images | grep drsim_common)
181 echo "SFTP: " $(docker images | grep atmoz/sftp)
182 echo "FTPES: " $(docker images | grep ftpes_vsftpd)
183 echo "HTTP/HTTPS/HTTPS no auth: " $(docker images | grep http_https_httpd)
184 echo "Consul: " $(docker images | grep consul)
185 echo "CBS: " $(docker images | grep platform.configbinding)
188 #Configure MR sim to use correct host:port for running dfc as an app or as a container
189 #Configure DR sim with correct address for DR redirect simulator
190 if [ $START_ARG == "manual-app" ]; then
191 export SFTP_SIMS=$SFTP_SIMS_LOCALHOST
192 export FTPES_SIMS=$FTPES_SIMS_LOCALHOST
193 export HTTP_SIMS=$HTTP_SIMS_LOCALHOST
194 export HTTP_JWT_SIMS=$HTTP_JWT_SIMS_LOCALHOST
195 export HTTPS_SIMS=$HTTPS_SIMS_LOCALHOST
196 export HTTPS_SIMS_NO_AUTH=HTTPS_SIMS_NO_AUTH_LOCALHOST
197 export HTTPS_JWT_SIMS=$HTTPS_JWT_SIMS_LOCALHOST
198 export DR_REDIR_SIM="localhost"
201 # export SFTP_SIMS=$SFTP_SIMS_CONTAINER
202 # export FTPES_SIMS=$FTPES_SIMS_CONTAINER
203 # export DR_REDIR_SIM="drsim_redir"
206 echo "----------------------------------- Test case steps -----------------------------------"
208 # Print error info for the call in the parent script (test case). Arg: <error-message-to-print>
209 # Not to be called from test script.
211 echo ${FUNCNAME[1]} " "$1" " ${BASH_SOURCE[$i+2]} " line" ${BASH_LINENO[$i+1]}
213 # Execute curl using the host and variable. Arg: <host and variable-name> [ <flag-to-strip-new-line> ]
214 #<flag-to-strip-new-line> may contain any string, it is just a flag
215 # Returns the variable value (if success) and return code 0 or an error message and return code 1
217 res=$(curl -skw "%{http_code}" $1)
218 http_code="${res:${#res}-3}"
219 if [ ${#res} -eq 3 ]; then
220 echo "<no-response-from-server>"
223 if [ $http_code -lt 200 ] && [ $http_code -gt 299 ]; then
224 echo "<not found, resp:${http_code}>"
227 if [ $# -eq 2 ]; then
228 echo "${res:0:${#res}-3}" | xargs
230 echo "${res:0:${#res}-3}"
237 # Test a simulator variable value towards target value using an condition operator with an optional timeout.
238 # Arg: <simulator-name> <host> <variable-name> <condition-operator> <target-value> - This test is done
239 # immediately and sets pass or fail depending on the result of comparing variable and target using the operator.
240 # Arg: <simulator-name> <host> <variable-name> <condition-operator> <target-value> <timeout> - This test waits up to the timeout
241 # before setting pass or fail depending on the result of comparing variable and target using the operator.
242 # Not to be called from test script.
245 if [ $# -eq 6 ]; then
246 echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} within ${6} seconds ----"
252 result="$(__do_curl $2$3)"
254 result=${result//[[:blank:]]/} #Strip blanks
255 duration=$((SECONDS-start))
256 if [ $((ctr%30)) -eq 0 ]; then
257 echo " Result=${result} after ${duration} seconds"
258 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
259 if [[ $STARTED_DFCS =~ "_"$DFC_APP_BASE$i"_" ]]; then
260 echo " HB ${DFC_APP_BASE}${i}: $(__do_curl http://127.0.0.1:$(($DFC_PORT+$i))/status strip)"
264 echo -ne " Result=${result} after ${duration} seconds\033[0K\r"
267 if [ $retcode -ne 0 ]; then
268 if [ $duration -gt $6 ]; then
270 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached in ${6} seconds, result = ${result} ----"
273 elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
275 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
276 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds ----"
278 elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
280 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
281 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result} ----"
283 elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
285 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
286 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result} ----"
288 elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
290 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
291 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result} ----"
294 if [ $duration -gt $6 ]; then
296 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached in ${6} seconds, result = ${result} ----"
302 elif [ $# -eq 5 ]; then
303 echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} ----"
305 result="$(__do_curl $2$3)"
307 result=${result//[[:blank:]]/} #Strip blanks
308 if [ $retcode -ne 0 ]; then
310 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
311 elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
313 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met"
314 elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
316 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
317 elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
319 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
320 elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
322 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
325 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
328 echo "Wrong args to __var_test, needs five or six args: <simulator-name> <host> <variable-name> <condition-operator> <target-value> [ <timeout> ]"
332 # Stops a named container
334 if [ $# -ne 1 ]; then
335 echo "__docker_stop need 1 arg <container-name>"
338 tmp=$(docker stop $1 2>/dev/null)
339 if [ -z $tmp ] || [ $tmp != $1 ]; then
340 echo " ${1} container not stopped or not existing"
342 echo " ${1} container stopped"
346 # Starts a named container (that has previously been stopped)
348 if [ $# -ne 1 ]; then
349 echo "__docker_start need 1 arg <container-name>"
352 tmp=$(docker start $1 2>/dev/null)
353 if [ -z $tmp ] || [ $tmp != $1 ]; then
354 echo " ${1} container not started or not existing"
356 echo " ${1} container started"
360 # Removes a named container
362 if [ $# -ne 1 ]; then
363 echo "__docker_rm need 1 arg <container-name>"
366 tmp=$(docker rm $1 2>/dev/null)
367 if [ -z $tmp ] || [ $tmp != $1 ]; then
368 echo " ${1} container not removed or not existing"
370 echo " ${1} container removed"
374 __start_dfc_image() {
377 __print_err "need tow args, <dfc-instance-name> 0.."$$DFC_MAX_IDX
381 if [ $2 -lt 0 ] || [ $2 -gt $DFC_MAX_IDX ]; then
382 __print_err "need two args, <dfc-instance-name> 0.."$DFC_MAX_IDX
386 localport=$(($DFC_PORT + $2))
387 localport_secure=$(($DFC_PORT_SECURE + $2))
389 echo "Creating docker network "$DOCKER_SIM_NWNAME", if needed"
391 docker network ls| grep "$DOCKER_SIM_NWNAME" > /dev/null || docker network create "$DOCKER_SIM_NWNAME"
393 echo "Starting DFC: " $appname " with ports mapped to " $localport " and " $localport_secure " in docker network "$DOCKER_SIM_NWNAME
394 docker run -d --volume $(pwd)/../simulator-group/tls/:/opt/app/datafile/etc/cert/ -p $localport":8100" -p $localport_secure":8433" --network=$DOCKER_SIM_NWNAME -e CONSUL_HOST=$CONSUL_HOST -e CONSUL_PORT=$CONSUL_PORT -e CONFIG_BINDING_SERVICE=$CONFIG_BINDING_SERVICE -e CONFIG_BINDING_SERVICE_SERVICE_PORT=$CONFIG_BINDING_SERVICE_SERVICE_PORT -e HOSTNAME=$appname --name $appname $DFC_IMAGE
399 if [ $(docker inspect --format '{{ .State.Running }}' $appname) ]
401 echo " Image: $(docker inspect --format '{{ .Config.Image }}' ${appname})"
402 echo "DFC container ${appname} running"
409 if ! [ $dfc_started ]; then
410 echo "DFC container ${appname} could not be started"
415 echo "Waiting for DFC ${appname} heartbeat..."
417 result="$(__do_curl http://127.0.0.1:${localport}/heartbeat)"
418 if [ $? -eq 0 ]; then
419 echo "DFC ${appname} responds to heartbeat: " $result
421 result="$(__do_curl http://127.0.0.1:${localport}/actuator/info)"
422 echo "DFC ${appname} image build info: " $result
429 if [ "$dfc_hb" = "false" ]; then
430 echo "DFC ${appname} did not respond to heartbeat"
435 # Function for waiting for named container to be started manually.
436 __wait_for_container() {
439 echo "Need one arg: <container-name> <instance-id>"
442 http=$(($DFC_PORT+$2))
443 https=$((DFC_PORT_SECURE+$2))
444 echo "The container is expected to map its ports (8100/8433) to the following port visibile on the host: http port ${http} and https port ${https}"
445 echo "Waiting for container with name '${1}' to be started manually...."
449 if [ $(docker inspect --format '{{ .State.Running }}' $1 2> /dev/null) ]; then
450 echo "Container running: "$1
453 duration=$((SECONDS-start))
454 echo -ne " Waited ${duration} seconds\033[0K\r"
459 echo "Connecting container "$1" to simulator network "$DOCKER_SIM_NWNAME
460 docker network connect $DOCKER_SIM_NWNAME $1
463 #WFunction for waiting for named container to be stopped manually.
464 __wait_for_container_gone() {
467 echo "Need one arg: <container-name>"
470 echo "Disconnecting container "$1" from simulator network "$DOCKER_SIM_NWNAME
471 docker network disconnect $DOCKER_SIM_NWNAME $1
472 echo "Waiting for container with name '${1}' to be stopped manually...."
476 if [ $(docker inspect --format '{{ .State.Running }}' $1 2> /dev/null) ]; then
477 duration=$((SECONDS-start))
478 echo -ne " Waited ${duration} seconds\033[0K\r"
481 echo "Container stopped: "$1
487 #Function for waiting to dfc to be started manually
489 http=$(($DFC_PORT+$2))
490 https=$((DFC_PORT_SECURE+$2))
491 echo "The app is expected to listen to http port ${http} and https port ${https}"
492 echo "The app shall use 'localhost' and '8500' for CONSUL_HOST and CONSUL_PORT."
493 echo "The app shale use 'config-binding-service-localhost' for CONFIG_BINDING_SERVICE"
494 echo "The app shall use ${1} for HOSTNAME."
495 read -p "Press enter to continue when app mapping to ${1} has been manually started"
498 #Function for waiting to dfc to be stopped manually
499 __wait_for_dfc_gone() {
500 read -p "Press enter to continue when when app mapping to ${1} has been manually stopped"
503 #############################################################
504 ############## Functions for auto test scripts ##############
505 #############################################################
507 # Print the env variables needed for the simulators and their setup
509 echo "Simulator settings"
511 echo "MR_GROUPS= "$MR_GROUPS
512 echo "MR_FILE_PREFIX_MAPPING="$MR_FILE_PREFIX_MAPPING
514 echo "DR_FEEDS= "$DR_FEEDS
515 echo "DR_REDIR_SIM= "$DR_REDIR_SIM
516 echo "DR_REDIR_TC= "$DR_REDIR_TC
517 echo "DR_REDIR_FEEDS= "$DR_REDIR_FEEDS
519 echo "NUM_FTPFILES= "$NUM_FTPFILES
520 echo "NUM_HTTPFILES= "$NUM_HTTPFILES
521 echo "NUM_PNFS= "$NUM_PNFS
522 echo "FILE_SIZE= "$FILE_SIZE
523 echo "FTP_TYPE= "$FTP_TYPE
524 echo "HTTP_TYPE= "$HTTP_TYPE
525 echo "FTP_FILE_PREFIXES= "$FTP_FILE_PREFIXES
526 echo "HTTP_FILE_PREFIXES= "$HTTP_FILE_PREFIXES
527 echo "NUM_FTP_SERVERS= "$NUM_FTP_SERVERS
528 echo "NUM_HTTP_SERVERS= "$NUM_HTTP_SERVERS
529 echo "SFTP_SIMS= "$SFTP_SIMS
530 echo "FTPES_SIMS= "$FTPES_SIMS
531 echo "HTTP_SIMS= "$HTTP_SIMS
532 echo "HTTP_JWT_SIMS= "$HTTP_JWT_SIMS
533 echo "HTTPS_SIMS= "$HTTPS_SIMS
534 echo "HTTPS_SIMS_NO_AUTH= "$HTTPS_SIMS_NO_AUTH
535 echo "HTTPS_JWT_SIMS= "$HTTPS_JWT_SIMS
539 # Stop and remove all containers including dfc app and simulators
541 echo "Stopping all containers, dfc app(s) and simulators with name prefix 'dfc_'"
542 docker stop $(docker ps -q --filter name=dfc_) &> /dev/null
543 echo "Removing all containers, dfc app and simulators with name prefix 'dfc_'"
544 docker rm $(docker ps -a -q --filter name=dfc_) &> /dev/null
545 docker rm -f $(docker ps -a -q --filter name=oom-certservice-post-processor) &> /dev/null
546 echo "Removing unused docker networks with substring 'dfc' in network name"
547 docker network rm $(docker network ls -q --filter name=dfc)
551 # Start all simulators in the simulator group
554 echo "Starting all simulators"
557 export SIM_GROUP=$SIM_GROUP
558 $SIM_GROUP/simulators-start.sh
563 # Start the dfc application
567 __print_err "need one arg, <dfc-instance-id>"
571 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
572 __print_err "arg should be 0.."$DFC_MAX_IDX
575 appname=$DFC_APP_BASE$1
576 STARTED_DFCS=$STARTED_DFCS"_"$appname"_"
578 if [ $START_ARG == "local" ] || [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
579 __start_dfc_image $appname $1
580 elif [ $START_ARG == "manual-container" ]; then
581 __wait_for_container $appname $1
582 elif [ $START_ARG == "manual-app" ]; then
583 __wait_for_dfc $appname $1
587 # Configure consul with dfc config, args <dfc-instance-id> <json-file-path>
588 # Not intended to be called directly by test scripts.
592 __print_err "need two args, <dfc-instance-id> <json-file-path>"
596 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
597 __print_err "dfc-instance-id should be 0.."$DFC_MAX_IDX
601 __print_err "json file does not extis: "$2
605 appname=$DFC_APP_BASE$1
607 echo "Configuring consul for " $appname " from " $2
608 curl -s http://127.0.0.1:${CONSUL_PORT}/v1/kv/${appname}?dc=dc1 -X PUT -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data-binary "@"$2 >/dev/null
611 # Configure consul with dfc app config, args <dfc-instance-id> <json-file-path>
612 consul_config_app() {
613 if [ $START_ARG == "manual-app" ]; then
614 echo "Replacing 'mrsim' with 'localhost' in json app config for consul"
615 sed 's/mrsim/localhost/g' $2 > .tmp_app.json
616 echo "Replacing 'drsim' with 'localhost' in json dmaap config for consul"
617 sed 's/drsim/localhost/g' .tmp_app.json > .app.json
618 __consul_config $1 .app.json
620 __consul_config $1 $2
624 # Stop and remove the dfc app container
628 __print_err "need one arg, <dfc-instance-id>"
632 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
633 __print_err "arg should be 0.."$DFC_MAX_IDX
636 appname=$DFC_APP_BASE$1
638 echo "Killing DFC, instance id: "$1
640 if [ $START_ARG == "local" ] || [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
641 __docker_stop $appname
643 elif [ $START_ARG == "manual-container" ]; then
644 __wait_for_container_gone $appname
645 elif [ $START_ARG == "manual-app" ]; then
646 __wait_for_dfc_gone $appname
650 # Stop and remove the DR simulator container
652 echo "Killing DR sim"
653 __docker_stop dfc_dr-sim
654 __docker_rm dfc_dr-sim
657 # Stop and remove the DR redir simulator container
659 echo "Killing DR redir sim"
660 __docker_stop dfc_dr-redir-sim
661 __docker_rm dfc_dr-redir-sim
664 # Stop and remove the MR simulator container
666 echo "Killing MR sim"
667 __docker_stop dfc_mr-sim
668 __docker_rm dfc_mr-sim
671 # Stop and remove the SFTP container, arg: <sftp-instance-id>
675 __print_err "need one arg, <sftp-instance-id>"
679 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
680 __print_err "arg should be 0.."$FTP_MAX_IDX
685 echo "Killing SFTP, instance id: "$1
687 __docker_stop $appname
691 # Stop SFTP container, arg: <sftp-instance-id>
695 __print_err "need one arg, <sftp-instance-id>"
699 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
700 __print_err "arg should be 0.."$FTP_MAX_IDX
705 echo "Stopping SFTP, instance id: "$1
707 __docker_stop $appname
710 # Starts a stopped SFTP container, arg: <sftp-instance-id>
714 __print_err "need one arg, <sftp-instance-id>"
718 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
719 __print_err "arg should be 0.."$FTP_MAX_IDX
724 echo "Starting SFTP, instance id: "$1
726 __docker_start $appname
729 # Stop and remove the FTPES container, arg: <ftpes-instance-id>
733 __print_err "need one arg, <ftpes-instance-id>"
737 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
738 __print_err "arg should be 0.."$FTP_MAX_IDX
741 appname=$FTPES_BASE$1
743 echo "Killing FTPES, instance id: "$1
745 __docker_stop $appname
749 # Stop FTPES container, arg: <ftpes-instance-id>
753 __print_err "need one arg, <ftpes-instance-id>"
757 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
758 __print_err "arg should be 0.."$FTP_MAX_IDX
761 appname=$FTPES_BASE$1
763 echo "Stopping FTPES, instance id: "$1
765 __docker_stop $appname
768 # Starts a stopped FTPES container, arg: <ftpes-instance-id>
772 __print_err "need one arg, <ftpes-instance-id>"
776 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
777 __print_err "arg should be 0.."$FTP_MAX_IDX
780 appname=$FTPES_BASE$1
782 echo "Starting FTPES, instance id: "$1
784 __docker_start $appname
787 # Stop and remove the HTTP container, arg: <http-instance-id>
791 __print_err "need one arg, <http-instance-id>"
795 if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
796 __print_err "arg should be 0.."$HTTP_MAX_IDX
799 appname=$HTTP_HTTPS_BASE$1
801 echo "Killing HTTP/HTTPS, instance id: "$1
803 __docker_stop $appname
807 # Stop HTTP container, arg: <http-instance-id>
811 __print_err "need one arg, <http-instance-id>"
815 if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
816 __print_err "arg should be 0.."$HTTP_MAX_IDX
819 appname=$HTTP_HTTPS_BASE$1
821 echo "Stopping HTTP/HTTPS, instance id: "$1
823 __docker_stop $appname
826 # Starts a stopped HTTP container, arg: <http-instance-id>
830 __print_err "need one arg, <http-instance-id>"
834 if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
835 __print_err "arg should be 0.."$HTTP_MAX_IDX
838 appname=$HTTP_HTTPS_BASE$1
840 echo "Starting HTTP/HTTPS, instance id: "$1
842 __docker_start $appname
845 # Print a variable value from the MR simulator. Arg: <variable-name>
848 __print_err "need one arg, <sim-param>"
851 echo -e "---- MR sim, \033[1m $1 \033[0m: $(__do_curl http://127.0.0.1:$MR_PORT/$1)"
854 # Print a variable value from the MR https simulator. Arg: <variable-name>
857 __print_err "need one arg, <sim-param>"
860 echo -e "---- MR sim, \033[1m $1 \033[0m: $(__do_curl https://127.0.0.1:$MR_PORT_SECURE/$1)"
863 # Print a variable value from the DR simulator. Arg: <variable-name>
866 __print_err "need one arg, <sim-param>"
869 echo -e "---- DR sim, \033[1m $1 \033[0m: $(__do_curl http://127.0.0.1:$DR_PORT/$1)"
872 # Print a variable value from the DR redir simulator. Arg: <variable-name>
875 __print_err "need one arg, <sim-param>"
878 echo -e "---- DR redir sim, \033[1m $1 \033[0m: $(__do_curl http://127.0.0.1:$DRR_PORT/$1)"
880 # Print a variable value from dfc. Arg: <dfc-instance-id> <variable-name>
883 __print_err "need two args, <dfc-instance-id> <dfc-param>"
886 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
887 __print_err "dfc instance id should be in range 0.."DFC_MAX_IDX
890 localport=$(($DFC_PORT + $1))
891 appname=$DFC_APP_BASE$1
892 echo -e "---- DFC $appname, \033[1m $2 \033[0m: $(__do_curl http://127.0.0.1:$localport/$2)"
895 # Read a variable value from MR sim and send to stdout. Arg: <variable-name>
897 echo "$(__do_curl http://127.0.0.1:$MR_PORT/$1)"
900 # Read a variable value from MR https sim and send to stdout. Arg: <variable-name>
902 echo "$(__do_curl https://127.0.0.1:$MR_PORT_SECURE/$1)"
905 # Read a variable value from DR sim and send to stdout. Arg: <variable-name>
907 echo "$(__do_curl http://127.0.0.1:$DR_PORT/$1)"
910 # Read a variable value from DR redir sim and send to stdout. Arg: <variable-name>
912 echo "$(__do_curl http://127.0.0.1:$DRR_PORT/$1)"
916 # Sleep. Arg: <sleep-time-in-sec>
919 __print_err "need one arg, <sleep-time-in-sec>"
922 echo "---- Sleep for " $1 " seconds ----"
924 duration=$((SECONDS-start))
925 while [ $duration -lt $1 ]; do
926 echo -ne " Slept for ${duration} seconds\033[0K\r"
928 duration=$((SECONDS-start))
933 # Sleep and print dfc heartbeat. Arg: <sleep-time-in-sec>
936 __print_err "need one arg, <sleep-time-in-sec>"
939 echo "---- Sleep for " $1 " seconds ----"
942 duration=$((SECONDS-start))
945 while [ $duration -lt $1 ]; do
946 if [ $rows -eq 0 ]; then
950 echo " Slept for ${duration} seconds"
951 if [ $((ctr%30)) -eq 0 ]; then
952 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
953 if [[ $STARTED_DFCS =~ "_"$DFC_APP_BASE$i"_" ]]; then
955 echo " HB ${DFC_APP_BASE}${i}: $(__do_curl http://127.0.0.1:$(($DFC_PORT+$i))/heartbeat)"
962 duration=$((SECONDS-start))
967 # Tests if a variable value in the MR simulator is equal to a target value and and optional timeout.
968 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
969 # equal to the target or not.
970 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
971 # before setting pass or fail depending on if the variable value becomes equal to the target
974 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
975 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 "=" $2 $3
977 __print_err "Wrong args to mr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
982 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
983 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 "=" $2 $3
985 __print_err "Wrong args to mr_secure_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
989 # Tests if a variable value in the MR simulator is greater than a target value and and optional timeout.
990 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
991 # greater than the target or not.
992 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
993 # before setting pass or fail depending on if the variable value greater than the target
996 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
997 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 ">" $2 $3
999 __print_err "Wrong args to mr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1003 mr_secure_greater() {
1004 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1005 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 ">" $2 $3
1007 __print_err "Wrong args to mr_secure_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1011 # Tests if a variable value in the MR simulator is less than a target value and and optional timeout.
1012 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1013 # less than the target or not.
1014 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1015 # before setting pass or fail depending on if the variable value less than the target
1018 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1019 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 "<" $2 $3
1021 __print_err "Wrong args to mr_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1025 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1026 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 "<" $2 $3
1028 __print_err "Wrong args to mr_secure_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1032 # Tests if a variable value in the MR simulator contains the target string and and optional timeout.
1033 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable contains
1034 # the target or not.
1035 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1036 # before setting pass or fail depending on if the variable value contains the target
1039 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1040 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 "contain_str" $2 $3
1042 __print_err "Wrong args to mr_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1045 mr_secure_contain_str() {
1046 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1047 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 "contain_str" $2 $3
1049 __print_err "Wrong args to mr_secure_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1053 # Tests if a variable value in the DR simulator is equal to a target value and and optional timeout.
1054 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1055 # equal to the target or not.
1056 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1057 # before setting pass or fail depending on if the variable value becomes equal to the target
1060 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1061 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 "=" $2 $3
1063 __print_err "Wrong args to dr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
1067 # Tests if a variable value in the DR simulator is greater than a target value and and optional timeout.
1068 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1069 # greater than the target or not.
1070 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1071 # before setting pass or fail depending on if the variable value greater than the target
1074 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1075 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 ">" $2 $3
1077 __print_err "Wrong args to dr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1081 # Tests if a variable value in the DR simulator is less than a target value and and optional timeout.
1082 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1083 # less than the target or not.
1084 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1085 # before setting pass or fail depending on if the variable value less than the target
1088 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1089 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 "<" $2 $3
1091 __print_err "Wrong args to dr_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1095 # Tests if a variable value in the DR simulator contains the target string and and optional timeout.
1096 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable contains
1097 # the target or not.
1098 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1099 # before setting pass or fail depending on if the variable value contains the target
1102 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1103 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 "contain_str" $2 $3
1105 __print_err "Wrong args to dr_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1109 # Tests if a variable value in the DR Redir simulator is equal to a target value and and optional timeout.
1110 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1111 # equal to the target or not.
1112 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1113 # before setting pass or fail depending on if the variable value becomes equal to the target
1116 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1117 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 "=" $2 $3
1119 __print_err "Wrong args to drr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
1124 # Tests if a variable value in the DR Redir simulator is greater a target value and and optional timeout.
1125 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1126 # greater the target or not.
1127 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1128 # before setting pass or fail depending on if the variable value greater than the target
1131 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1132 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 ">" $2 $3
1134 __print_err "Wrong args to drr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1138 # Tests if a variable value in the DR Redir simulator is less than a target value and and optional timeout.
1139 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1140 # less than the target or not.
1141 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1142 # before setting pass or fail depending on if the variable value less than the target
1145 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1146 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 "<" $2 $3
1148 __print_err "Wrong args to drr_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1152 # Tests if a variable value in the DR redir simulator contains the target string and and optional timeout.
1153 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable contains
1154 # the target or not.
1155 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1156 # before setting pass or fail depending on if the variable value contains the target
1159 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1160 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 "contain_str" $2 $3
1162 __print_err "Wrong args to drr_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1166 #Test if a variable in the DFC contains a substring. Arg: <dfc-index> <variable-name> <substring-in-quotes>
1168 if [ $# -eq 3 ]; then
1169 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
1170 __print_err "arg should be 0.."$DFC_MAX_IDX
1173 appname=$DFC_APP_BASE$1
1174 localport=$(($DFC_PORT + $1))
1175 echo -e "---- DFC test criteria: $appname \033[1m ${2} \033[0m contains: ${3} ----"
1177 result="$(__do_curl http://127.0.0.1:$localport/${2})"
1178 if [[ $result =~ $3 ]]; then
1180 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met"
1183 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target '${3}' not reached, result = ${result} ----"
1186 echo "Wrong args to dfc_contain_str, needs three arg: <dfc-index> <dfc-variable> <str>"
1191 # Store all dfc app and simulators log to the test case log dir. All logs gets a prefix to
1192 # separate logs stored at different steps in the test script. Arg: <tc-id> <log-prefix>
1194 if [ $# != 1 ]; then
1195 __print_err "need one arg, <file-prefix>"
1198 echo "Storing all container logs and dfc app log using prefix: "$1
1199 if ! [ $START_ARG == "manual-app" ]; then
1200 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
1201 appname=$DFC_APP_BASE$i
1202 tmp=$(docker ps | grep $appname)
1203 if ! [ -z "$tmp" ]; then #Only stored logs from running DFC apps
1204 docker cp $appname:/var/log/ONAP/application.log $TESTLOGS/$ATC/${1}_${appname}_application.log
1205 docker logs $appname > $TESTLOGS/$ATC/$1_$appname-docker.log 2>&1
1209 docker logs dfc_mr-sim > $TESTLOGS/$ATC/$1_dfc_mr-sim-docker.log 2>&1
1210 docker logs dfc_dr-sim > $TESTLOGS/$ATC/$1_dfc_dr-sim-docker.log 2>&1
1211 docker logs dfc_dr-redir-sim > $TESTLOGS/$ATC/$1_dfc_dr-redir-sim-docker.log 2>&1
1213 for (( i=0; i<=$FTP_MAX_IDX; i++ )); do
1214 appname=$SFTP_BASE$i
1215 docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
1216 appname=$FTPES_BASE$i
1217 docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
1220 for (( i=0; i<=$HTTP_MAX_IDX; i++ )); do
1221 appname=$HTTP_HTTPS_BASE$i
1222 docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
1225 docker logs dfc_consul > $TESTLOGS/$ATC/$1_consul.log 2>&1
1226 docker logs dfc_cbs > $TESTLOGS/$ATC/$1_cbs.log 2>&1
1228 # Check the dfc application log, for all dfc instances, for WARN and ERR messages and print the count.
1230 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
1231 appname=$DFC_APP_BASE$i
1232 tmp=$(docker ps | grep $appname)
1233 if ! [ -z "$tmp" ]; then #Only check logs for running dfc_apps
1234 _check_dfc_log $appname
1239 # Check dfc app log for one dfc instance, arg <dfc-app-name>
1241 echo "Checking $1 log $DFC_LOGPATH for WARNINGs and ERRORs"
1242 foundentries=$(docker exec -it $1 grep WARN /var/log/ONAP/application.log | wc -l)
1243 if [ $? -ne 0 ];then
1244 echo " Problem to search $1 log $DFC_LOGPATH"
1246 if [ $foundentries -eq 0 ]; then
1247 echo " No WARN entries found in $1 log $DFC_LOGPATH"
1249 echo -e " Found \033[1m"$foundentries"\033[0m WARN entries in $1 log $DFC_LOGPATH"
1252 foundentries=$(docker exec -it $1 grep ERR $DFC_LOGPATH | wc -l)
1253 if [ $? -ne 0 ];then
1254 echo " Problem to search $1 log $DFC_LOGPATH"
1256 if [ $foundentries -eq 0 ]; then
1257 echo " No ERR entries found in $1 log $DFC_LOGPATH"
1259 echo -e " Found \033[1m"$foundentries"\033[0m ERR entries in $1 log $DFC_LOGPATH"
1266 echo "---- DFC and all sim variables"
1268 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
1269 appname=$DFC_APP_BASE$i
1270 tmp=$(docker ps | grep $appname)
1271 if ! [ -z "$tmp" ]; then #Only check running dfc_apps
1279 mr_print execution_time
1282 mr_print fileprefixes
1283 mr_print exe_time_first_poll
1284 mr_print groups/exe_time_first_poll
1285 mr_print ctr_requests
1286 mr_print groups/ctr_requests
1287 mr_print ctr_responses
1288 mr_print groups/ctr_responses
1290 mr_print groups/ctr_files
1291 mr_print ctr_unique_files
1292 mr_print groups/ctr_unique_files
1293 mr_print groups/ctr_events
1295 mr_print ctr_unique_PNFs
1296 mr_print groups/ctr_unique_PNFs
1299 dr_print execution_time
1301 dr_print ctr_publish_query
1302 dr_print feeds/ctr_publish_query
1303 dr_print ctr_publish_query_bad_file_prefix
1304 dr_print feeds/ctr_publish_query_bad_file_prefix
1305 dr_print ctr_publish_query_published
1306 dr_print feeds/ctr_publish_query_published
1307 dr_print ctr_publish_query_not_published
1308 dr_print feeds/ctr_publish_query_not_published
1309 dr_print ctr_publish_req
1310 dr_print feeds/ctr_publish_req
1311 dr_print ctr_publish_req_bad_file_prefix
1312 dr_print feeds/ctr_publish_req_bad_file_prefix
1313 dr_print ctr_publish_req_redirect
1314 dr_print feeds/ctr_publish_req_redirect
1315 dr_print ctr_publish_req_published
1316 dr_print feeds/ctr_publish_req_published
1317 dr_print ctr_published_files
1318 dr_print feeds/ctr_published_files
1319 dr_print ctr_double_publish
1320 dr_print feeds/ctr_double_publish
1323 drr_print execution_time
1325 drr_print ctr_publish_requests
1326 drr_print feeds/ctr_publish_requests
1327 drr_print ctr_publish_requests_bad_file_prefix
1328 drr_print feeds/ctr_publish_requests_bad_file_prefix
1329 drr_print ctr_publish_responses
1330 drr_print feeds/ctr_publish_responses
1331 drr_print dwl_volume
1332 drr_print feeds/dwl_volume
1333 drr_print time_lastpublish
1334 drr_print feeds/time_lastpublish
1337 # Print the test result
1341 duration=$((TCTEST_END-TCTEST_START))
1343 echo "-------------------------------------------------------------------------------------------------"
1344 echo "------------------------------------- Test case: "$ATC
1345 echo "------------------------------------- Ended: "$(date)
1346 echo "-------------------------------------------------------------------------------------------------"
1347 echo "-- Description: "$TC_ONELINE_DESCR
1348 echo "-- Execution time: " $duration " seconds"
1349 echo "-------------------------------------------------------------------------------------------------"
1350 echo "------------------------------------- RESULTS"
1354 total=$((RES_PASS+RES_FAIL))
1355 if [ $RES_TEST -eq 0 ]; then
1356 echo -e "\033[1mNo tests seem to have executed. Check the script....\033[0m"
1357 echo -e "\033[31m\033[1m ___ ___ ___ ___ ___ _____ ___ _ ___ _ _ _ ___ ___ \033[0m"
1358 echo -e "\033[31m\033[1m/ __|/ __| _ \_ _| _ \_ _| | __/_\ |_ _| | | | | | _ \ __|\033[0m"
1359 echo -e "\033[31m\033[1m\__ \ (__| /| || _/ | | | _/ _ \ | || |_| |_| | / _| \033[0m"
1360 echo -e "\033[31m\033[1m|___/\___|_|_\___|_| |_| |_/_/ \_\___|____\___/|_|_\___|\033[0m"
1361 elif [ $total != $RES_TEST ]; then
1362 echo -e "\033[1mTotal number of tests does not match the sum of passed and failed tests. Check the script....\033[0m"
1363 echo -e "\033[31m\033[1m ___ ___ ___ ___ ___ _____ ___ _ ___ _ _ _ ___ ___ \033[0m"
1364 echo -e "\033[31m\033[1m/ __|/ __| _ \_ _| _ \_ _| | __/_\ |_ _| | | | | | _ \ __|\033[0m"
1365 echo -e "\033[31m\033[1m\__ \ (__| /| || _/ | | | _/ _ \ | || |_| |_| | / _| \033[0m"
1366 echo -e "\033[31m\033[1m|___/\___|_|_\___|_| |_| |_/_/ \_\___|____\___/|_|_\___|\033[0m"
1367 elif [ $RES_PASS = $RES_TEST ]; then
1368 echo -e "All tests \033[32m\033[1mPASS\033[0m"
1369 echo -e "\033[32m\033[1m ___ _ ___ ___ \033[0m"
1370 echo -e "\033[32m\033[1m | _ \/_\ / __/ __| \033[0m"
1371 echo -e "\033[32m\033[1m | _/ _ \\__ \__ \\ \033[0m"
1372 echo -e "\033[32m\033[1m |_|/_/ \_\___/___/ \033[0m"
1375 # Update test suite counter
1376 if [ -f .tmp_tcsuite_pass_ctr ]; then
1377 tmpval=$(< .tmp_tcsuite_pass_ctr)
1379 echo $tmpval > .tmp_tcsuite_pass_ctr
1381 if [ -f .tmp_tcsuite_pass ]; then
1382 echo " - "$ATC " -- "$TC_ONELINE_DESCR" Execution time: "$duration" seconds" >> .tmp_tcsuite_pass
1385 echo -e "One or more tests with status \033[31m\033[1mFAIL\033[0m "
1386 echo -e "\033[31m\033[1m ___ _ ___ _ \033[0m"
1387 echo -e "\033[31m\033[1m | __/_\ |_ _| | \033[0m"
1388 echo -e "\033[31m\033[1m | _/ _ \ | || |__ \033[0m"
1389 echo -e "\033[31m\033[1m |_/_/ \_\___|____|\033[0m"
1391 # Update test suite counter
1392 if [ -f .tmp_tcsuite_fail_ctr ]; then
1393 tmpval=$(< .tmp_tcsuite_fail_ctr)
1395 echo $tmpval > .tmp_tcsuite_fail_ctr
1397 if [ -f .tmp_tcsuite_fail ]; then
1398 echo " - "$ATC " -- "$TC_ONELINE_DESCR" Execution time: "$duration" seconds" >> .tmp_tcsuite_fail
1402 echo "++++ Number of tests: "$RES_TEST
1403 echo "++++ Number of passed tests: "$RES_PASS
1404 echo "++++ Number of failed tests: "$RES_FAIL
1405 echo "------------------------------------- Test case complete ---------------------------------"
1406 echo "-------------------------------------------------------------------------------------------------"