Skip to content

Commit

Permalink
Merge pull request #145 from jajik/improve-tests
Browse files Browse the repository at this point in the history
Improve tests
  • Loading branch information
jajik authored Oct 3, 2023
2 parents 6ea97f1 + 71b962b commit 463033c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 141 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ enclose the corresponding part of code like this

The style check will ignore everything between the two comments. (Please, don't abuse it.)

Tests
-----

The project contains some tests too. You can find them with a separate README in the `test` subdirectory.

License
-------

Expand Down
125 changes: 0 additions & 125 deletions test/Advertise.c

This file was deleted.

17 changes: 3 additions & 14 deletions test/includes/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ run_test() {
docker cp ${httpd_cont}:/usr/local/apache2/logs/access_log "logs/${2:-$1}-httpd_access.log" > /dev/null
fi
# Clean all after run
httpd_shutdown > /dev/null 2>&1
httpd_all_clean > /dev/null 2>&1
tomcat_all_remove > /dev/null 2>&1
return $ret
}
Expand All @@ -49,7 +49,7 @@ httpd_create() {
# Build and run httpd container
httpd_run() {
# if httpd is already running for some reason, end it
httpd_shutdown || true
httpd_all_clean || true
if [ $DEBUG ]; then
echo "httpd mod_proxy_cluster image config:"
echo " CONF: ${MPC_CONF:-httpd/mod_proxy_cluster.conf}"
Expand Down Expand Up @@ -79,19 +79,8 @@ httpd_wait_until_ready() {
echo "httpd ready after $i attempts"
}

httpd_shutdown() {
docker ps --format "{{.Names}}" | grep ${MPC_NAME:-httpd-mod_proxy_cluster}
if [ $? = 0 ]; then
docker stop ${MPC_NAME:-httpd-mod_proxy_cluster}
fi
docker ps -a --format "{{.Names}}" | grep ${MPC_NAME:-httpd-mod_proxy_cluster}
if [ $? = 0 ]; then
docker rm ${MPC_NAME:-httpd-mod_proxy_cluster}
fi
}

httpd_all_clean() {
for i in $(docker ps -a | grep "$HTTPD_IMG\|MODCLUSTER\|JBCS" | cut -f1 -d' ');
for i in $(docker ps -a | grep "$HTTPD_IMG\|MODCLUSTER\|JBCS\|${MPC_NAME:-httpd-mod_proxy_cluster}" | cut -f1 -d' ');
do
docker stop $i
docker rm $i
Expand Down
8 changes: 6 additions & 2 deletions test/setup-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
TEST_DIR=$(pwd)
cd ../..
# get websocket demo repository
git clone https://github.com/jfclere/httpd_websocket
if [ ! -d httpd_websocket ]; then
git clone https://github.com/jfclere/httpd_websocket
fi
cd httpd_websocket
git pull --rebase
mvn install || exit 1
cp target/websocket-hello-0.0.1.war $TEST_DIR/tomcat/
cd ..

# get mod_cluster (Java/Tomcat part)
git clone https://github.com/modcluster/mod_cluster
if [ ! -d mod_cluster ]; then
git clone https://github.com/modcluster/mod_cluster
fi
cd mod_cluster
git pull --rebase
mvn install || exit 2
Expand Down

0 comments on commit 463033c

Please sign in to comment.