From 6ffa415f834718e38a9c531aba8922b8ca4afe6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 29 Aug 2024 14:04:37 +0200 Subject: [PATCH] test: Tweak test functions names, drop unnecessary ones --- test/MODCLUSTER-640/testit.sh | 5 ++--- test/MODCLUSTER-734/testit.sh | 5 ++--- test/MODCLUSTER-736/testit.sh | 4 ++-- test/MODCLUSTER-755/testit.sh | 4 ++-- test/MODCLUSTER-785/testit.sh | 5 ++--- test/MODCLUSTER-794/testit.sh | 5 ++--- test/basetests.sh | 4 ++-- test/hangingtests.sh | 8 +++----- test/includes/common.sh | 34 +++++----------------------------- test/maintests.sh | 4 ++-- test/testsuite.sh | 4 ++-- test/websocket/basic.sh | 4 ++-- 12 files changed, 28 insertions(+), 58 deletions(-) diff --git a/test/MODCLUSTER-640/testit.sh b/test/MODCLUSTER-640/testit.sh index 3316d0b7d..2b0364f08 100755 --- a/test/MODCLUSTER-640/testit.sh +++ b/test/MODCLUSTER-640/testit.sh @@ -3,13 +3,12 @@ . includes/common.sh # first stop any previously running tests. -tomcat_all_stop tomcat_all_remove -httpd_all_clean +httpd_remove # build httpd + mod_proxy_cluster rm -f nohup.out -MPC_CONF=MODCLUSTER-640/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-640 httpd_run +MPC_CONF=MODCLUSTER-640/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-640 httpd_start # wait until httpd is started httpd_wait_until_ready || exit 1 diff --git a/test/MODCLUSTER-734/testit.sh b/test/MODCLUSTER-734/testit.sh index fec94b573..97842f0aa 100755 --- a/test/MODCLUSTER-734/testit.sh +++ b/test/MODCLUSTER-734/testit.sh @@ -3,13 +3,12 @@ . includes/common.sh # first stop any previously running tests. -tomcat_all_stop tomcat_all_remove -httpd_all_clean +httpd_remove # build httpd + mod_proxy_cluster rm -f nohup.out -MPC_CONF=MODCLUSTER-734/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-734 httpd_run +MPC_CONF=MODCLUSTER-734/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-734 httpd_start # wait until httpd is started httpd_wait_until_ready || exit 1 diff --git a/test/MODCLUSTER-736/testit.sh b/test/MODCLUSTER-736/testit.sh index d32714e4c..894a66f43 100644 --- a/test/MODCLUSTER-736/testit.sh +++ b/test/MODCLUSTER-736/testit.sh @@ -2,9 +2,9 @@ . includes/common.sh -httpd_all_clean +httpd_remove tomcat_all_remove -MPC_NAME=MODCLUSTER-736 httpd_run +MPC_NAME=MODCLUSTER-736 httpd_start # Start a bunch ($1, or 6 if no argument is given) of tomcat # containers, then test them and stop them diff --git a/test/MODCLUSTER-755/testit.sh b/test/MODCLUSTER-755/testit.sh index 9d13d48c7..82b067625 100755 --- a/test/MODCLUSTER-755/testit.sh +++ b/test/MODCLUSTER-755/testit.sh @@ -8,10 +8,10 @@ . includes/common.sh -httpd_all_clean +httpd_remove tomcat_all_remove -MPC_CONF=MODCLUSTER-755/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-755 httpd_run +MPC_CONF=MODCLUSTER-755/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-755 httpd_start httpd_wait_until_ready diff --git a/test/MODCLUSTER-785/testit.sh b/test/MODCLUSTER-785/testit.sh index b2eea5ab1..cba858dd8 100755 --- a/test/MODCLUSTER-785/testit.sh +++ b/test/MODCLUSTER-785/testit.sh @@ -4,12 +4,12 @@ # first stop any previously running tests. tomcat_all_remove -httpd_all_clean +httpd_remove # build httpd + mod_proxy_cluster rm -f nohup.out -MPC_CONF=MODCLUSTER-785/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-785 httpd_run +MPC_CONF=MODCLUSTER-785/mod_proxy_cluster.conf MPC_NAME=MODCLUSTER-785 httpd_start # start tomcat1 on 8080 @@ -30,7 +30,6 @@ if [ $? -ne 0 ]; then fi # Stop abruptly -tomcat_stop 1 tomcat_remove 1 # it return 503 diff --git a/test/MODCLUSTER-794/testit.sh b/test/MODCLUSTER-794/testit.sh index ee3b99936..d8d62e3a6 100644 --- a/test/MODCLUSTER-794/testit.sh +++ b/test/MODCLUSTER-794/testit.sh @@ -3,11 +3,10 @@ . includes/common.sh # first stop any previously running tests. -tomcat_all_stop tomcat_all_remove -httpd_all_clean +httpd_remove -MPC_NAME=MODCLUSTER-794 MPC_CONF=MODCLUSTER-794/mod_proxy_cluster.conf httpd_run +MPC_NAME=MODCLUSTER-794 MPC_CONF=MODCLUSTER-794/mod_proxy_cluster.conf httpd_start for i in {1..20}; do tomcat_start $i diff --git a/test/basetests.sh b/test/basetests.sh index d1da736c8..296d9639e 100644 --- a/test/basetests.sh +++ b/test/basetests.sh @@ -2,10 +2,10 @@ . includes/common.sh -httpd_all_clean +httpd_remove tomcat_all_remove -httpd_run || exit 1 +httpd_start || exit 1 # Start 2 tomcats, on 8080 and 8081 tomcat_start_two || exit 1 diff --git a/test/hangingtests.sh b/test/hangingtests.sh index 0b596ca79..79cf22a30 100644 --- a/test/hangingtests.sh +++ b/test/hangingtests.sh @@ -2,7 +2,7 @@ . includes/common.sh -httpd_all_clean +httpd_remove tomcat_all_remove @@ -26,7 +26,7 @@ jdbexit() { #################################### ### S T A R T T E S T S ### #################################### -httpd_run +httpd_start # Create files we need cat << EOF > continue.txt @@ -102,7 +102,5 @@ jdbexit tomcat_wait_for_n_nodes 1 || exit 1 # Cleanup at the end -tomcat_all_stop -tomcat_wait_for_n_nodes 0 || exit 1 - tomcat_all_remove +tomcat_wait_for_n_nodes 0 || exit 1 diff --git a/test/includes/common.sh b/test/includes/common.sh index ab701106b..7ed2c2c82 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -30,7 +30,7 @@ run_test() { docker cp ${httpd_cont}:/usr/local/apache2/logs/access_log "logs/${2:-$1}-httpd_access.log" 2> /dev/null || true fi # Clean all after run - httpd_all_clean > /dev/null 2>&1 + httpd_remove > /dev/null 2>&1 tomcat_all_remove > /dev/null 2>&1 return $ret } @@ -58,9 +58,9 @@ httpd_create() { } # Build and run httpd container -httpd_run() { +httpd_start() { # if httpd is already running for some reason, end it - httpd_all_clean || true + httpd_remove || true if [ $DEBUG ]; then echo "httpd mod_proxy_cluster image config:" echo " CONF: ${MPC_CONF:-httpd/mod_proxy_cluster.conf}" @@ -90,7 +90,7 @@ httpd_wait_until_ready() { echo "httpd ready after $i attempts" } -httpd_all_clean() { +httpd_remove() { for i in $(docker ps -a | grep "$HTTPD_IMG\|MODCLUSTER\|JBCS\|${MPC_NAME:-httpd-mod_proxy_cluster}" | cut -f1 -d' '); do docker stop $i @@ -99,7 +99,7 @@ httpd_all_clean() { } clean_and_exit() { - httpd_all_clean + httpd_remove exit ${1:-1} } @@ -160,30 +160,6 @@ tomcat_start() { fi } -# -# Stop running given dockered tomcat -tomcat_stop() { - docker ps | grep tomcat$1 - if [ $? -eq 0 ]; then - docker stop tomcat$1 - if [ $? -ne 0 ]; then - echo "Can't stop tomcat$1" - exit 1 - fi - else - echo "$1 is not running" - fi -} - -# -# Stop running all dockered tomcats -tomcat_all_stop() { - for i in $(docker ps -a --format "{{.Names}}" | grep tomcat | sed -e 's/tomcat//g') - do - tomcat_stop $i - done -} - # # Wait until there are $1 nodes in OK state (i.e., some will start or go away if the count is different) tomcat_wait_for_n_nodes() { diff --git a/test/maintests.sh b/test/maintests.sh index 306d2a84d..b73a505c9 100644 --- a/test/maintests.sh +++ b/test/maintests.sh @@ -13,11 +13,11 @@ echotestlabel() { echotestlabel "Starting tests!!!" # remove possibly running containers -httpd_all_clean +httpd_remove tomcat_all_remove # run a fresh httpd -httpd_run +httpd_start tomcat_start_two || exit 1 tomcat_wait_for_n_nodes 2 || exit 1 diff --git a/test/testsuite.sh b/test/testsuite.sh index 1d10345a0..a7d7b8982 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -55,7 +55,7 @@ echo " Done" # clean everything at first echo -n "Cleaning possibly running containers..." -httpd_all_clean > /dev/null 2>&1 +httpd_remove > /dev/null 2>&1 tomcat_all_remove > /dev/null 2>&1 echo " Done" @@ -104,7 +104,7 @@ res=$(expr $res + $?) echo -n "Cleaning containers if any..." -httpd_all_clean > /dev/null 2>&1 +httpd_remove > /dev/null 2>&1 tomcat_all_remove > /dev/null 2>&1 echo " Done" diff --git a/test/websocket/basic.sh b/test/websocket/basic.sh index 22d93c104..f312d5415 100644 --- a/test/websocket/basic.sh +++ b/test/websocket/basic.sh @@ -3,11 +3,11 @@ . includes/common.sh # remove possibly running containers -httpd_all_clean +httpd_remove tomcat_all_remove # run a fresh httpd -httpd_run +httpd_start docker cp websocket/mod_proxy_cluster.conf $MPC_NAME:/usr/local/apache2/conf/mod_proxy_cluster.conf docker exec $MPC_NAME /usr/local/apache2/bin/apachectl restart