Skip to content

Commit

Permalink
test: Tweak test functions names, drop unnecessary ones
Browse files Browse the repository at this point in the history
  • Loading branch information
jajik committed Aug 29, 2024
1 parent 3a926aa commit 843df43
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 58 deletions.
5 changes: 2 additions & 3 deletions test/MODCLUSTER-640/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions test/MODCLUSTER-734/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/MODCLUSTER-736/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/MODCLUSTER-755/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions test/MODCLUSTER-785/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,7 +30,6 @@ if [ $? -ne 0 ]; then
fi

# Stop abruptly
tomcat_stop 1
tomcat_remove 1

# it return 503
Expand Down
5 changes: 2 additions & 3 deletions test/MODCLUSTER-794/testit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/basetests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions test/hangingtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

. includes/common.sh

httpd_all_clean
httpd_remove
tomcat_all_remove


Expand All @@ -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
Expand Down Expand Up @@ -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
34 changes: 5 additions & 29 deletions test/includes/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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}"
Expand Down Expand Up @@ -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
Expand All @@ -99,7 +99,7 @@ httpd_all_clean() {
}

clean_and_exit() {
httpd_all_clean
httpd_remove
exit ${1:-1}
}

Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions test/maintests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"

Expand Down
4 changes: 2 additions & 2 deletions test/websocket/basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 843df43

Please sign in to comment.