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)
186 #Configure MR sim to use correct host:port for running dfc as an app or as a container
187 #Configure DR sim with correct address for DR redirect simulator
188 if [ $START_ARG == "manual-app" ]; then
189 export SFTP_SIMS=$SFTP_SIMS_LOCALHOST
190 export FTPES_SIMS=$FTPES_SIMS_LOCALHOST
191 export HTTP_SIMS=$HTTP_SIMS_LOCALHOST
192 export HTTP_JWT_SIMS=$HTTP_JWT_SIMS_LOCALHOST
193 export HTTPS_SIMS=$HTTPS_SIMS_LOCALHOST
194 export HTTPS_SIMS_NO_AUTH=HTTPS_SIMS_NO_AUTH_LOCALHOST
195 export HTTPS_JWT_SIMS=$HTTPS_JWT_SIMS_LOCALHOST
196 export DR_REDIR_SIM="localhost"
199 # export SFTP_SIMS=$SFTP_SIMS_CONTAINER
200 # export FTPES_SIMS=$FTPES_SIMS_CONTAINER
201 # export DR_REDIR_SIM="drsim_redir"
204 echo "----------------------------------- Test case steps -----------------------------------"
206 # Print error info for the call in the parent script (test case). Arg: <error-message-to-print>
207 # Not to be called from test script.
209 echo ${FUNCNAME[1]} " "$1" " ${BASH_SOURCE[$i+2]} " line" ${BASH_LINENO[$i+1]}
211 # Execute curl using the host and variable. Arg: <host and variable-name> [ <flag-to-strip-new-line> ]
212 #<flag-to-strip-new-line> may contain any string, it is just a flag
213 # Returns the variable value (if success) and return code 0 or an error message and return code 1
215 res=$(curl -skw "%{http_code}" $1)
216 http_code="${res:${#res}-3}"
217 if [ ${#res} -eq 3 ]; then
218 echo "<no-response-from-server>"
221 if [ $http_code -lt 200 ] && [ $http_code -gt 299 ]; then
222 echo "<not found, resp:${http_code}>"
225 if [ $# -eq 2 ]; then
226 echo "${res:0:${#res}-3}" | xargs
228 echo "${res:0:${#res}-3}"
235 # Test a simulator variable value towards target value using an condition operator with an optional timeout.
236 # Arg: <simulator-name> <host> <variable-name> <condition-operator> <target-value> - This test is done
237 # immediately and sets pass or fail depending on the result of comparing variable and target using the operator.
238 # Arg: <simulator-name> <host> <variable-name> <condition-operator> <target-value> <timeout> - This test waits up to the timeout
239 # before setting pass or fail depending on the result of comparing variable and target using the operator.
240 # Not to be called from test script.
243 if [ $# -eq 6 ]; then
244 echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} within ${6} seconds ----"
250 result="$(__do_curl $2$3)"
252 result=${result//[[:blank:]]/} #Strip blanks
253 duration=$((SECONDS-start))
254 if [ $((ctr%30)) -eq 0 ]; then
255 echo " Result=${result} after ${duration} seconds"
256 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
257 if [[ $STARTED_DFCS =~ "_"$DFC_APP_BASE$i"_" ]]; then
258 echo " HB ${DFC_APP_BASE}${i}: $(__do_curl http://127.0.0.1:$(($DFC_PORT+$i))/status strip)"
262 echo -ne " Result=${result} after ${duration} seconds\033[0K\r"
265 if [ $retcode -ne 0 ]; then
266 if [ $duration -gt $6 ]; then
268 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached in ${6} seconds, result = ${result} ----"
271 elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
273 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
274 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds ----"
276 elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
278 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
279 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result} ----"
281 elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
283 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
284 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result} ----"
286 elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
288 echo -e " Result=${result} after ${duration} seconds\033[0K\r"
289 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met in ${duration} seconds, result = ${result} ----"
292 if [ $duration -gt $6 ]; then
294 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached in ${6} seconds, result = ${result} ----"
300 elif [ $# -eq 5 ]; then
301 echo -e "---- ${1} sim test criteria: \033[1m ${3} \033[0m ${4} ${5} ----"
303 result="$(__do_curl $2$3)"
305 result=${result//[[:blank:]]/} #Strip blanks
306 if [ $retcode -ne 0 ]; then
308 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
309 elif [ $4 = "=" ] && [ "$result" -eq $5 ]; then
311 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met"
312 elif [ $4 = ">" ] && [ "$result" -gt $5 ]; then
314 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
315 elif [ $4 = "<" ] && [ "$result" -lt $5 ]; then
317 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
318 elif [ $4 = "contain_str" ] && [[ $result =~ $5 ]]; then
320 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met, result = ${result} ----"
323 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target ${3} ${4} ${5} not reached, result = ${result} ----"
326 echo "Wrong args to __var_test, needs five or six args: <simulator-name> <host> <variable-name> <condition-operator> <target-value> [ <timeout> ]"
330 # Stops a named container
332 if [ $# -ne 1 ]; then
333 echo "__docker_stop need 1 arg <container-name>"
336 tmp=$(docker stop $1 2>/dev/null)
337 if [ -z $tmp ] || [ $tmp != $1 ]; then
338 echo " ${1} container not stopped or not existing"
340 echo " ${1} container stopped"
344 # Starts a named container (that has previously been stopped)
346 if [ $# -ne 1 ]; then
347 echo "__docker_start need 1 arg <container-name>"
350 tmp=$(docker start $1 2>/dev/null)
351 if [ -z $tmp ] || [ $tmp != $1 ]; then
352 echo " ${1} container not started or not existing"
354 echo " ${1} container started"
358 # Removes a named container
360 if [ $# -ne 1 ]; then
361 echo "__docker_rm need 1 arg <container-name>"
364 tmp=$(docker rm $1 2>/dev/null)
365 if [ -z $tmp ] || [ $tmp != $1 ]; then
366 echo " ${1} container not removed or not existing"
368 echo " ${1} container removed"
372 __start_dfc_image() {
375 __print_err "need tow args, <dfc-instance-name> 0.."$$DFC_MAX_IDX
379 if [ $2 -lt 0 ] || [ $2 -gt $DFC_MAX_IDX ]; then
380 __print_err "need two args, <dfc-instance-name> 0.."$DFC_MAX_IDX
384 localport=$(($DFC_PORT + $2))
385 localport_secure=$(($DFC_PORT_SECURE + $2))
387 echo "Creating docker network "$DOCKER_SIM_NWNAME", if needed"
389 docker network ls| grep "$DOCKER_SIM_NWNAME" > /dev/null || docker network create "$DOCKER_SIM_NWNAME"
391 echo "Starting DFC: " $appname " with ports mapped to " $localport " and " $localport_secure " in docker network "$DOCKER_SIM_NWNAME
392 docker run -d --volume $(pwd)/../simulator-group/tls/:/opt/app/datafile/etc/cert/ --volume $(pwd)/../simulator-group/dfc_config_volume/:/app-config/ -p $localport":8100" -p $localport_secure":8433" --network=$DOCKER_SIM_NWNAME -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
397 if [ $(docker inspect --format '{{ .State.Running }}' $appname) ]
399 echo " Image: $(docker inspect --format '{{ .Config.Image }}' ${appname})"
400 echo "DFC container ${appname} running"
407 if ! [ $dfc_started ]; then
408 echo "DFC container ${appname} could not be started"
413 echo "Waiting for DFC ${appname} heartbeat..."
415 result="$(__do_curl http://127.0.0.1:${localport}/heartbeat)"
416 if [ $? -eq 0 ]; then
417 echo "DFC ${appname} responds to heartbeat: " $result
419 result="$(__do_curl http://127.0.0.1:${localport}/actuator/info)"
420 echo "DFC ${appname} image build info: " $result
427 if [ "$dfc_hb" = "false" ]; then
428 echo "DFC ${appname} did not respond to heartbeat"
433 # Function for waiting for named container to be started manually.
434 __wait_for_container() {
437 echo "Need one arg: <container-name> <instance-id>"
440 http=$(($DFC_PORT+$2))
441 https=$((DFC_PORT_SECURE+$2))
442 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}"
443 echo "Waiting for container with name '${1}' to be started manually...."
447 if [ $(docker inspect --format '{{ .State.Running }}' $1 2> /dev/null) ]; then
448 echo "Container running: "$1
451 duration=$((SECONDS-start))
452 echo -ne " Waited ${duration} seconds\033[0K\r"
457 echo "Connecting container "$1" to simulator network "$DOCKER_SIM_NWNAME
458 docker network connect $DOCKER_SIM_NWNAME $1
461 #WFunction for waiting for named container to be stopped manually.
462 __wait_for_container_gone() {
465 echo "Need one arg: <container-name>"
468 echo "Disconnecting container "$1" from simulator network "$DOCKER_SIM_NWNAME
469 docker network disconnect $DOCKER_SIM_NWNAME $1
470 echo "Waiting for container with name '${1}' to be stopped manually...."
474 if [ $(docker inspect --format '{{ .State.Running }}' $1 2> /dev/null) ]; then
475 duration=$((SECONDS-start))
476 echo -ne " Waited ${duration} seconds\033[0K\r"
479 echo "Container stopped: "$1
485 #Function for waiting to dfc to be started manually
487 http=$(($DFC_PORT+$2))
488 https=$((DFC_PORT_SECURE+$2))
489 echo "The app is expected to listen to http port ${http} and https port ${https}"
490 echo "The app shall use ${1} for HOSTNAME."
491 read -p "Press enter to continue when app mapping to ${1} has been manually started"
494 #Function for waiting to dfc to be stopped manually
495 __wait_for_dfc_gone() {
496 read -p "Press enter to continue when when app mapping to ${1} has been manually stopped"
499 #############################################################
500 ############## Functions for auto test scripts ##############
501 #############################################################
503 # Print the env variables needed for the simulators and their setup
505 echo "Simulator settings"
507 echo "MR_GROUPS= "$MR_GROUPS
508 echo "MR_FILE_PREFIX_MAPPING="$MR_FILE_PREFIX_MAPPING
510 echo "DR_FEEDS= "$DR_FEEDS
511 echo "DR_REDIR_SIM= "$DR_REDIR_SIM
512 echo "DR_REDIR_TC= "$DR_REDIR_TC
513 echo "DR_REDIR_FEEDS= "$DR_REDIR_FEEDS
515 echo "NUM_FTPFILES= "$NUM_FTPFILES
516 echo "NUM_HTTPFILES= "$NUM_HTTPFILES
517 echo "NUM_PNFS= "$NUM_PNFS
518 echo "FILE_SIZE= "$FILE_SIZE
519 echo "FTP_TYPE= "$FTP_TYPE
520 echo "HTTP_TYPE= "$HTTP_TYPE
521 echo "FTP_FILE_PREFIXES= "$FTP_FILE_PREFIXES
522 echo "HTTP_FILE_PREFIXES= "$HTTP_FILE_PREFIXES
523 echo "NUM_FTP_SERVERS= "$NUM_FTP_SERVERS
524 echo "NUM_HTTP_SERVERS= "$NUM_HTTP_SERVERS
525 echo "SFTP_SIMS= "$SFTP_SIMS
526 echo "FTPES_SIMS= "$FTPES_SIMS
527 echo "HTTP_SIMS= "$HTTP_SIMS
528 echo "HTTP_JWT_SIMS= "$HTTP_JWT_SIMS
529 echo "HTTPS_SIMS= "$HTTPS_SIMS
530 echo "HTTPS_SIMS_NO_AUTH= "$HTTPS_SIMS_NO_AUTH
531 echo "HTTPS_JWT_SIMS= "$HTTPS_JWT_SIMS
535 # Stop and remove all containers including dfc app and simulators
537 echo "Stopping all containers, dfc app(s) and simulators with name prefix 'dfc_'"
538 docker stop $(docker ps -q --filter name=dfc_) &> /dev/null
539 echo "Removing all containers, dfc app and simulators with name prefix 'dfc_'"
540 docker rm $(docker ps -a -q --filter name=dfc_) &> /dev/null
541 docker rm -f $(docker ps -a -q --filter name=oom-certservice-post-processor) &> /dev/null
542 echo "Removing unused docker networks with substring 'dfc' in network name"
543 docker network rm $(docker network ls -q --filter name=dfc)
547 # Start all simulators in the simulator group
550 echo "Starting all simulators"
553 export SIM_GROUP=$SIM_GROUP
554 $SIM_GROUP/simulators-start.sh
559 # Start the dfc application
563 __print_err "need one arg, <dfc-instance-id>"
567 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
568 __print_err "arg should be 0.."$DFC_MAX_IDX
571 appname=$DFC_APP_BASE$1
572 STARTED_DFCS=$STARTED_DFCS"_"$appname"_"
574 if [ $START_ARG == "local" ] || [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
575 __start_dfc_image $appname $1
576 elif [ $START_ARG == "manual-container" ]; then
577 __wait_for_container $appname $1
578 elif [ $START_ARG == "manual-app" ]; then
579 __wait_for_dfc $appname $1
583 # Configure volume with dfc config, args <dfc-instance-id> <yaml-file-path>
584 # Not intended to be called directly by test scripts.
588 __print_err "need two args, <dfc-instance-id> <yaml-file-path>"
592 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
593 __print_err "dfc-instance-id should be 0.."$DFC_MAX_IDX
597 __print_err "yaml file does not exist: "$2
601 appname=$DFC_APP_BASE$1
603 echo "Applying configuration for " $appname " from " $2
604 mkdir $(pwd)/../simulator-group/dfc_config_volume/
605 cp $2 $(pwd)/../simulator-group/dfc_config_volume/application_config.yaml
608 # Configure volume with dfc app config, args <dfc-instance-id> <yaml-file-path>
610 if [ $START_ARG == "manual-app" ]; then
611 echo "Replacing 'mrsim' with 'localhost' in yaml app config"
612 sed 's/mrsim/localhost/g' $2 > .tmp_app.yaml
613 echo "Replacing 'drsim' with 'localhost' in yaml dmaap config"
614 sed 's/drsim/localhost/g' .tmp_app.yaml > .app.yaml
615 __dfc_config $1 .app.yaml
621 # Stop and remove the dfc app container
625 __print_err "need one arg, <dfc-instance-id>"
629 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
630 __print_err "arg should be 0.."$DFC_MAX_IDX
633 appname=$DFC_APP_BASE$1
635 echo "Killing DFC, instance id: "$1
637 if [ $START_ARG == "local" ] || [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
638 __docker_stop $appname
640 elif [ $START_ARG == "manual-container" ]; then
641 __wait_for_container_gone $appname
642 elif [ $START_ARG == "manual-app" ]; then
643 __wait_for_dfc_gone $appname
646 rm -rf $(pwd)/../simulator-group/dfc_config_volume
649 # Stop and remove the DR simulator container
651 echo "Killing DR sim"
652 __docker_stop dfc_dr-sim
653 __docker_rm dfc_dr-sim
656 # Stop and remove the DR redir simulator container
658 echo "Killing DR redir sim"
659 __docker_stop dfc_dr-redir-sim
660 __docker_rm dfc_dr-redir-sim
663 # Stop and remove the MR simulator container
665 echo "Killing MR sim"
666 __docker_stop dfc_mr-sim
667 __docker_rm dfc_mr-sim
670 # Stop and remove the SFTP container, arg: <sftp-instance-id>
674 __print_err "need one arg, <sftp-instance-id>"
678 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
679 __print_err "arg should be 0.."$FTP_MAX_IDX
684 echo "Killing SFTP, instance id: "$1
686 __docker_stop $appname
690 # Stop SFTP container, arg: <sftp-instance-id>
694 __print_err "need one arg, <sftp-instance-id>"
698 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
699 __print_err "arg should be 0.."$FTP_MAX_IDX
704 echo "Stopping SFTP, instance id: "$1
706 __docker_stop $appname
709 # Starts a stopped SFTP container, arg: <sftp-instance-id>
713 __print_err "need one arg, <sftp-instance-id>"
717 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
718 __print_err "arg should be 0.."$FTP_MAX_IDX
723 echo "Starting SFTP, instance id: "$1
725 __docker_start $appname
728 # Stop and remove the FTPES container, arg: <ftpes-instance-id>
732 __print_err "need one arg, <ftpes-instance-id>"
736 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
737 __print_err "arg should be 0.."$FTP_MAX_IDX
740 appname=$FTPES_BASE$1
742 echo "Killing FTPES, instance id: "$1
744 __docker_stop $appname
748 # Stop FTPES container, arg: <ftpes-instance-id>
752 __print_err "need one arg, <ftpes-instance-id>"
756 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
757 __print_err "arg should be 0.."$FTP_MAX_IDX
760 appname=$FTPES_BASE$1
762 echo "Stopping FTPES, instance id: "$1
764 __docker_stop $appname
767 # Starts a stopped FTPES container, arg: <ftpes-instance-id>
771 __print_err "need one arg, <ftpes-instance-id>"
775 if [ $1 -lt 0 ] || [ $1 -gt $FTP_MAX_IDX ]; then
776 __print_err "arg should be 0.."$FTP_MAX_IDX
779 appname=$FTPES_BASE$1
781 echo "Starting FTPES, instance id: "$1
783 __docker_start $appname
786 # Stop and remove the HTTP container, arg: <http-instance-id>
790 __print_err "need one arg, <http-instance-id>"
794 if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
795 __print_err "arg should be 0.."$HTTP_MAX_IDX
798 appname=$HTTP_HTTPS_BASE$1
800 echo "Killing HTTP/HTTPS, instance id: "$1
802 __docker_stop $appname
806 # Stop HTTP container, arg: <http-instance-id>
810 __print_err "need one arg, <http-instance-id>"
814 if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
815 __print_err "arg should be 0.."$HTTP_MAX_IDX
818 appname=$HTTP_HTTPS_BASE$1
820 echo "Stopping HTTP/HTTPS, instance id: "$1
822 __docker_stop $appname
825 # Starts a stopped HTTP container, arg: <http-instance-id>
829 __print_err "need one arg, <http-instance-id>"
833 if [ $1 -lt 0 ] || [ $1 -gt $HTTP_MAX_IDX ]; then
834 __print_err "arg should be 0.."$HTTP_MAX_IDX
837 appname=$HTTP_HTTPS_BASE$1
839 echo "Starting HTTP/HTTPS, instance id: "$1
841 __docker_start $appname
844 # Print a variable value from the MR simulator. Arg: <variable-name>
847 __print_err "need one arg, <sim-param>"
850 echo -e "---- MR sim, \033[1m $1 \033[0m: $(__do_curl http://127.0.0.1:$MR_PORT/$1)"
853 # Print a variable value from the MR https simulator. Arg: <variable-name>
856 __print_err "need one arg, <sim-param>"
859 echo -e "---- MR sim, \033[1m $1 \033[0m: $(__do_curl https://127.0.0.1:$MR_PORT_SECURE/$1)"
862 # Print a variable value from the DR simulator. Arg: <variable-name>
865 __print_err "need one arg, <sim-param>"
868 echo -e "---- DR sim, \033[1m $1 \033[0m: $(__do_curl http://127.0.0.1:$DR_PORT/$1)"
871 # Print a variable value from the DR redir simulator. Arg: <variable-name>
874 __print_err "need one arg, <sim-param>"
877 echo -e "---- DR redir sim, \033[1m $1 \033[0m: $(__do_curl http://127.0.0.1:$DRR_PORT/$1)"
879 # Print a variable value from dfc. Arg: <dfc-instance-id> <variable-name>
882 __print_err "need two args, <dfc-instance-id> <dfc-param>"
885 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
886 __print_err "dfc instance id should be in range 0.."DFC_MAX_IDX
889 localport=$(($DFC_PORT + $1))
890 appname=$DFC_APP_BASE$1
891 echo -e "---- DFC $appname, \033[1m $2 \033[0m: $(__do_curl http://127.0.0.1:$localport/$2)"
894 # Read a variable value from MR sim and send to stdout. Arg: <variable-name>
896 echo "$(__do_curl http://127.0.0.1:$MR_PORT/$1)"
899 # Read a variable value from MR https sim and send to stdout. Arg: <variable-name>
901 echo "$(__do_curl https://127.0.0.1:$MR_PORT_SECURE/$1)"
904 # Read a variable value from DR sim and send to stdout. Arg: <variable-name>
906 echo "$(__do_curl http://127.0.0.1:$DR_PORT/$1)"
909 # Read a variable value from DR redir sim and send to stdout. Arg: <variable-name>
911 echo "$(__do_curl http://127.0.0.1:$DRR_PORT/$1)"
915 # Sleep. Arg: <sleep-time-in-sec>
918 __print_err "need one arg, <sleep-time-in-sec>"
921 echo "---- Sleep for " $1 " seconds ----"
923 duration=$((SECONDS-start))
924 while [ $duration -lt $1 ]; do
925 echo -ne " Slept for ${duration} seconds\033[0K\r"
927 duration=$((SECONDS-start))
932 # Sleep and print dfc heartbeat. Arg: <sleep-time-in-sec>
935 __print_err "need one arg, <sleep-time-in-sec>"
938 echo "---- Sleep for " $1 " seconds ----"
941 duration=$((SECONDS-start))
944 while [ $duration -lt $1 ]; do
945 if [ $rows -eq 0 ]; then
949 echo " Slept for ${duration} seconds"
950 if [ $((ctr%30)) -eq 0 ]; then
951 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
952 if [[ $STARTED_DFCS =~ "_"$DFC_APP_BASE$i"_" ]]; then
954 echo " HB ${DFC_APP_BASE}${i}: $(__do_curl http://127.0.0.1:$(($DFC_PORT+$i))/heartbeat)"
961 duration=$((SECONDS-start))
966 # Tests if a variable value in the MR simulator is equal to a target value and and optional timeout.
967 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
968 # equal to the target or not.
969 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
970 # before setting pass or fail depending on if the variable value becomes equal to the target
973 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
974 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 "=" $2 $3
976 __print_err "Wrong args to mr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
981 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
982 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 "=" $2 $3
984 __print_err "Wrong args to mr_secure_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
988 # Tests if a variable value in the MR simulator is greater than a target value and and optional timeout.
989 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
990 # greater than the target or not.
991 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
992 # before setting pass or fail depending on if the variable value greater than the target
995 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
996 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 ">" $2 $3
998 __print_err "Wrong args to mr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1002 mr_secure_greater() {
1003 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1004 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 ">" $2 $3
1006 __print_err "Wrong args to mr_secure_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1010 # Tests if a variable value in the MR simulator is less than a target value and and optional timeout.
1011 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1012 # less than the target or not.
1013 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1014 # before setting pass or fail depending on if the variable value less than the target
1017 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1018 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 "<" $2 $3
1020 __print_err "Wrong args to mr_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1024 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1025 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 "<" $2 $3
1027 __print_err "Wrong args to mr_secure_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1031 # Tests if a variable value in the MR simulator contains the target string and and optional timeout.
1032 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable contains
1033 # the target or not.
1034 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1035 # before setting pass or fail depending on if the variable value contains the target
1038 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1039 __var_test "MR" "http://127.0.0.1:$MR_PORT/" $1 "contain_str" $2 $3
1041 __print_err "Wrong args to mr_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1044 mr_secure_contain_str() {
1045 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1046 __var_test "MR" "https://127.0.0.1:$MR_PORT_SECURE/" $1 "contain_str" $2 $3
1048 __print_err "Wrong args to mr_secure_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1052 # Tests if a variable value in the DR simulator is equal to a target value and and optional timeout.
1053 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1054 # equal to the target or not.
1055 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1056 # before setting pass or fail depending on if the variable value becomes equal to the target
1059 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1060 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 "=" $2 $3
1062 __print_err "Wrong args to dr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
1066 # Tests if a variable value in the DR simulator is greater than a target value and and optional timeout.
1067 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1068 # greater than the target or not.
1069 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1070 # before setting pass or fail depending on if the variable value greater than the target
1073 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1074 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 ">" $2 $3
1076 __print_err "Wrong args to dr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1080 # Tests if a variable value in the DR simulator is less than a target value and and optional timeout.
1081 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1082 # less than the target or not.
1083 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1084 # before setting pass or fail depending on if the variable value less than the target
1087 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1088 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 "<" $2 $3
1090 __print_err "Wrong args to dr_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1094 # Tests if a variable value in the DR simulator contains the target string and and optional timeout.
1095 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable contains
1096 # the target or not.
1097 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1098 # before setting pass or fail depending on if the variable value contains the target
1101 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1102 __var_test "DR" "http://127.0.0.1:$DR_PORT/" $1 "contain_str" $2 $3
1104 __print_err "Wrong args to dr_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1108 # Tests if a variable value in the DR Redir simulator is equal to a target value and and optional timeout.
1109 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1110 # equal to the target or not.
1111 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1112 # before setting pass or fail depending on if the variable value becomes equal to the target
1115 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1116 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 "=" $2 $3
1118 __print_err "Wrong args to drr_equal, needs two or three args: <sim-param> <target-value> [ timeout ]"
1123 # Tests if a variable value in the DR Redir simulator is greater a target value and and optional timeout.
1124 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1125 # greater the target or not.
1126 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1127 # before setting pass or fail depending on if the variable value greater than the target
1130 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1131 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 ">" $2 $3
1133 __print_err "Wrong args to drr_greater, needs two or three args: <sim-param> <target-value> [ timeout ]"
1137 # Tests if a variable value in the DR Redir simulator is less than a target value and and optional timeout.
1138 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable is
1139 # less than the target or not.
1140 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1141 # before setting pass or fail depending on if the variable value less than the target
1144 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1145 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 "<" $2 $3
1147 __print_err "Wrong args to drr_less, needs two or three args: <sim-param> <target-value> [ timeout ]"
1151 # Tests if a variable value in the DR redir simulator contains the target string and and optional timeout.
1152 # Arg: <variable-name> <target-value> - This test set pass or fail depending on if the variable contains
1153 # the target or not.
1154 # Arg: <variable-name> <target-value> <timeout-in-sec> - This test waits up to the timeout seconds
1155 # before setting pass or fail depending on if the variable value contains the target
1158 if [ $# -eq 2 ] || [ $# -eq 3 ]; then
1159 __var_test "DR REDIR" "http://127.0.0.1:$DRR_PORT/" $1 "contain_str" $2 $3
1161 __print_err "Wrong args to drr_contain_str, needs two or three args: <sim-param> <target-value> [ timeout ]"
1165 #Test if a variable in the DFC contains a substring. Arg: <dfc-index> <variable-name> <substring-in-quotes>
1167 if [ $# -eq 3 ]; then
1168 if [ $1 -lt 0 ] || [ $1 -gt $DFC_MAX_IDX ]; then
1169 __print_err "arg should be 0.."$DFC_MAX_IDX
1172 appname=$DFC_APP_BASE$1
1173 localport=$(($DFC_PORT + $1))
1174 echo -e "---- DFC test criteria: $appname \033[1m ${2} \033[0m contains: ${3} ----"
1176 result="$(__do_curl http://127.0.0.1:$localport/${2})"
1177 if [[ $result =~ $3 ]]; then
1179 echo -e "---- \033[32m\033[1mPASS\033[0m - Test criteria met"
1182 echo -e "---- \033[31m\033[1mFAIL\033[0m - Target '${3}' not reached, result = ${result} ----"
1185 echo "Wrong args to dfc_contain_str, needs three arg: <dfc-index> <dfc-variable> <str>"
1190 # Store all dfc app and simulators log to the test case log dir. All logs gets a prefix to
1191 # separate logs stored at different steps in the test script. Arg: <tc-id> <log-prefix>
1193 if [ $# != 1 ]; then
1194 __print_err "need one arg, <file-prefix>"
1197 echo "Storing all container logs and dfc app log using prefix: "$1
1198 if ! [ $START_ARG == "manual-app" ]; then
1199 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
1200 appname=$DFC_APP_BASE$i
1201 tmp=$(docker ps | grep $appname)
1202 if ! [ -z "$tmp" ]; then #Only stored logs from running DFC apps
1203 docker cp $appname:/var/log/ONAP/application.log $TESTLOGS/$ATC/${1}_${appname}_application.log
1204 docker logs $appname > $TESTLOGS/$ATC/$1_$appname-docker.log 2>&1
1208 docker logs dfc_mr-sim > $TESTLOGS/$ATC/$1_dfc_mr-sim-docker.log 2>&1
1209 docker logs dfc_dr-sim > $TESTLOGS/$ATC/$1_dfc_dr-sim-docker.log 2>&1
1210 docker logs dfc_dr-redir-sim > $TESTLOGS/$ATC/$1_dfc_dr-redir-sim-docker.log 2>&1
1212 for (( i=0; i<=$FTP_MAX_IDX; i++ )); do
1213 appname=$SFTP_BASE$i
1214 docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
1215 appname=$FTPES_BASE$i
1216 docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
1219 for (( i=0; i<=$HTTP_MAX_IDX; i++ )); do
1220 appname=$HTTP_HTTPS_BASE$i
1221 docker logs $appname > $TESTLOGS/$ATC/${1}_${appname}.log 2>&1
1225 # Check the dfc application log, for all dfc instances, for WARN and ERR messages and print the count.
1227 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
1228 appname=$DFC_APP_BASE$i
1229 tmp=$(docker ps | grep $appname)
1230 if ! [ -z "$tmp" ]; then #Only check logs for running dfc_apps
1231 _check_dfc_log $appname
1236 # Check dfc app log for one dfc instance, arg <dfc-app-name>
1238 echo "Checking $1 log $DFC_LOGPATH for WARNINGs and ERRORs"
1239 foundentries=$(docker exec -it $1 grep WARN /var/log/ONAP/application.log | wc -l)
1240 if [ $? -ne 0 ];then
1241 echo " Problem to search $1 log $DFC_LOGPATH"
1243 if [ $foundentries -eq 0 ]; then
1244 echo " No WARN entries found in $1 log $DFC_LOGPATH"
1246 echo -e " Found \033[1m"$foundentries"\033[0m WARN entries in $1 log $DFC_LOGPATH"
1249 foundentries=$(docker exec -it $1 grep ERR $DFC_LOGPATH | wc -l)
1250 if [ $? -ne 0 ];then
1251 echo " Problem to search $1 log $DFC_LOGPATH"
1253 if [ $foundentries -eq 0 ]; then
1254 echo " No ERR entries found in $1 log $DFC_LOGPATH"
1256 echo -e " Found \033[1m"$foundentries"\033[0m ERR entries in $1 log $DFC_LOGPATH"
1263 echo "---- DFC and all sim variables"
1265 for (( i=0; i<=$DFC_MAX_IDX; i++ )); do
1266 appname=$DFC_APP_BASE$i
1267 tmp=$(docker ps | grep $appname)
1268 if ! [ -z "$tmp" ]; then #Only check running dfc_apps
1276 mr_print execution_time
1279 mr_print fileprefixes
1280 mr_print exe_time_first_poll
1281 mr_print groups/exe_time_first_poll
1282 mr_print ctr_requests
1283 mr_print groups/ctr_requests
1284 mr_print ctr_responses
1285 mr_print groups/ctr_responses
1287 mr_print groups/ctr_files
1288 mr_print ctr_unique_files
1289 mr_print groups/ctr_unique_files
1290 mr_print groups/ctr_events
1292 mr_print ctr_unique_PNFs
1293 mr_print groups/ctr_unique_PNFs
1296 dr_print execution_time
1298 dr_print ctr_publish_query
1299 dr_print feeds/ctr_publish_query
1300 dr_print ctr_publish_query_bad_file_prefix
1301 dr_print feeds/ctr_publish_query_bad_file_prefix
1302 dr_print ctr_publish_query_published
1303 dr_print feeds/ctr_publish_query_published
1304 dr_print ctr_publish_query_not_published
1305 dr_print feeds/ctr_publish_query_not_published
1306 dr_print ctr_publish_req
1307 dr_print feeds/ctr_publish_req
1308 dr_print ctr_publish_req_bad_file_prefix
1309 dr_print feeds/ctr_publish_req_bad_file_prefix
1310 dr_print ctr_publish_req_redirect
1311 dr_print feeds/ctr_publish_req_redirect
1312 dr_print ctr_publish_req_published
1313 dr_print feeds/ctr_publish_req_published
1314 dr_print ctr_published_files
1315 dr_print feeds/ctr_published_files
1316 dr_print ctr_double_publish
1317 dr_print feeds/ctr_double_publish
1320 drr_print execution_time
1322 drr_print ctr_publish_requests
1323 drr_print feeds/ctr_publish_requests
1324 drr_print ctr_publish_requests_bad_file_prefix
1325 drr_print feeds/ctr_publish_requests_bad_file_prefix
1326 drr_print ctr_publish_responses
1327 drr_print feeds/ctr_publish_responses
1328 drr_print dwl_volume
1329 drr_print feeds/dwl_volume
1330 drr_print time_lastpublish
1331 drr_print feeds/time_lastpublish
1334 # Print the test result
1338 duration=$((TCTEST_END-TCTEST_START))
1340 echo "-------------------------------------------------------------------------------------------------"
1341 echo "------------------------------------- Test case: "$ATC
1342 echo "------------------------------------- Ended: "$(date)
1343 echo "-------------------------------------------------------------------------------------------------"
1344 echo "-- Description: "$TC_ONELINE_DESCR
1345 echo "-- Execution time: " $duration " seconds"
1346 echo "-------------------------------------------------------------------------------------------------"
1347 echo "------------------------------------- RESULTS"
1351 total=$((RES_PASS+RES_FAIL))
1352 if [ $RES_TEST -eq 0 ]; then
1353 echo -e "\033[1mNo tests seem to have executed. Check the script....\033[0m"
1354 echo -e "\033[31m\033[1m ___ ___ ___ ___ ___ _____ ___ _ ___ _ _ _ ___ ___ \033[0m"
1355 echo -e "\033[31m\033[1m/ __|/ __| _ \_ _| _ \_ _| | __/_\ |_ _| | | | | | _ \ __|\033[0m"
1356 echo -e "\033[31m\033[1m\__ \ (__| /| || _/ | | | _/ _ \ | || |_| |_| | / _| \033[0m"
1357 echo -e "\033[31m\033[1m|___/\___|_|_\___|_| |_| |_/_/ \_\___|____\___/|_|_\___|\033[0m"
1358 elif [ $total != $RES_TEST ]; then
1359 echo -e "\033[1mTotal number of tests does not match the sum of passed and failed tests. Check the script....\033[0m"
1360 echo -e "\033[31m\033[1m ___ ___ ___ ___ ___ _____ ___ _ ___ _ _ _ ___ ___ \033[0m"
1361 echo -e "\033[31m\033[1m/ __|/ __| _ \_ _| _ \_ _| | __/_\ |_ _| | | | | | _ \ __|\033[0m"
1362 echo -e "\033[31m\033[1m\__ \ (__| /| || _/ | | | _/ _ \ | || |_| |_| | / _| \033[0m"
1363 echo -e "\033[31m\033[1m|___/\___|_|_\___|_| |_| |_/_/ \_\___|____\___/|_|_\___|\033[0m"
1364 elif [ $RES_PASS = $RES_TEST ]; then
1365 echo -e "All tests \033[32m\033[1mPASS\033[0m"
1366 echo -e "\033[32m\033[1m ___ _ ___ ___ \033[0m"
1367 echo -e "\033[32m\033[1m | _ \/_\ / __/ __| \033[0m"
1368 echo -e "\033[32m\033[1m | _/ _ \\__ \__ \\ \033[0m"
1369 echo -e "\033[32m\033[1m |_|/_/ \_\___/___/ \033[0m"
1372 # Update test suite counter
1373 if [ -f .tmp_tcsuite_pass_ctr ]; then
1374 tmpval=$(< .tmp_tcsuite_pass_ctr)
1376 echo $tmpval > .tmp_tcsuite_pass_ctr
1378 if [ -f .tmp_tcsuite_pass ]; then
1379 echo " - "$ATC " -- "$TC_ONELINE_DESCR" Execution time: "$duration" seconds" >> .tmp_tcsuite_pass
1382 echo -e "One or more tests with status \033[31m\033[1mFAIL\033[0m "
1383 echo -e "\033[31m\033[1m ___ _ ___ _ \033[0m"
1384 echo -e "\033[31m\033[1m | __/_\ |_ _| | \033[0m"
1385 echo -e "\033[31m\033[1m | _/ _ \ | || |__ \033[0m"
1386 echo -e "\033[31m\033[1m |_/_/ \_\___|____|\033[0m"
1388 # Update test suite counter
1389 if [ -f .tmp_tcsuite_fail_ctr ]; then
1390 tmpval=$(< .tmp_tcsuite_fail_ctr)
1392 echo $tmpval > .tmp_tcsuite_fail_ctr
1394 if [ -f .tmp_tcsuite_fail ]; then
1395 echo " - "$ATC " -- "$TC_ONELINE_DESCR" Execution time: "$duration" seconds" >> .tmp_tcsuite_fail
1399 echo "++++ Number of tests: "$RES_TEST
1400 echo "++++ Number of passed tests: "$RES_PASS
1401 echo "++++ Number of failed tests: "$RES_FAIL
1402 echo "------------------------------------- Test case complete ---------------------------------"
1403 echo "-------------------------------------------------------------------------------------------------"