[Git][java-team/css-validator][master] d/test: improve reliability of tests:
bastif (@bastif)
gitlab at salsa.debian.org
Tue Mar 3 13:37:30 GMT 2026
bastif pushed to branch master at Debian Java Maintainers / css-validator
Commits:
2e6e8926 by Fab Stz at 2026-03-03T14:35:42+01:00
d/test: improve reliability of tests:
- print debug information in case of failure
- stop the service with --job-mode=triggering so that stopping jetty doesn't output to stderr
Stopping 'jetty9.service', but its triggering units are still active
- Check that the servlet is accessible (in addition to the readiness of the server)
- - - - -
3 changed files:
- debian/tests/webapp_validate_common.sh
- debian/tests/webapp_validate_file.sh
- debian/tests/webapp_validate_url.sh
Changes:
=====================================
debian/tests/webapp_validate_common.sh
=====================================
@@ -18,6 +18,9 @@ wait_until_not_state()
server="$1"
state="$2"
count=0
+ echo "Leaving state '$state' and entering state '$(systemctl show -P ActiveState "$server")'."
+ TIMEFORMAT='Elapsed time is %R seconds.'
+ { time {
while [ "$(systemctl show -P ActiveState "$server")" == "$state" ] ; do
if [ $count -gt 60 ]; then
break
@@ -25,10 +28,12 @@ wait_until_not_state()
count=$((count + 1))
sleep 1
done
+ } } 2>&1
if [ ! $count -gt 60 ]; then
- echo "Startup took $count seconds to leave state '$state' and enter state '$(systemctl show -P ActiveState "$server")'."
+ echo "Success."
else
- echo "$server failed starting up in less than 60 seconds"
+ echo "Failed (reached timeout)."
+ debug_failure
exit 1
fi
}
@@ -38,19 +43,24 @@ wait_until_ready()
local server port count
server="$1"
port="$2"
+ path="$3"
count=0
- while ! nc -z localhost "${port:-8080}" >/dev/null 2>&1; do
+ echo "Waiting until $server is up and running at http://localhost:${port:-8080}/$path"
+ TIMEFORMAT='Elapsed time is %R seconds.'
+ { time {
+ while ! nc -z localhost "${port:-8080}" >/dev/null 2>&1 && [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:${port:-8080}/$path)" != "200" ]]; do
if [ $count -gt 60 ]; then
break
fi
count=$((count + 1))
sleep 1
done
+ } } 2>&1
if [ ! $count -gt 60 ]; then
- echo "$server is now up and running at http://localhost:${port:-8080}"
- echo "Startup took $count seconds."
+ echo "Success."
else
- echo "$server failed starting up in less than 60 seconds"
+ echo "Failed (reached timeout)."
+ debug_failure
exit 1
fi
}
=====================================
debian/tests/webapp_validate_file.sh
=====================================
@@ -7,6 +7,7 @@ server="$1"
source "$(dirname "$0")"/webapp_validate_common.sh
PORT=8080
+CONTEXT_PATH="css-validator/"
if [ -n "$AUTOPKGTEST_TMP" ]; then
case "$server" in
@@ -18,10 +19,10 @@ if [ -n "$AUTOPKGTEST_TMP" ]; then
;;
esac
- sudo systemctl stop "$server"
+ sudo systemctl stop --job-mode=triggering "$server"
wait_until_not_state "$server" "active"
sudo systemctl start "$server"
- wait_until_ready "$server" "$PORT"
+ wait_until_ready "$server" "$PORT" "$CONTEXT_PATH"
sudo systemctl status "$server"
fi
=====================================
debian/tests/webapp_validate_url.sh
=====================================
@@ -7,6 +7,7 @@ server="$1"
source "$(dirname "$0")"/webapp_validate_common.sh
PORT=8080
+CONTEXT_PATH="css-validator/"
if [ -n "$AUTOPKGTEST_TMP" ]; then
case "$server" in
@@ -18,10 +19,10 @@ if [ -n "$AUTOPKGTEST_TMP" ]; then
;;
esac
- sudo systemctl stop "$server"
+ sudo systemctl stop --job-mode=triggering "$server"
wait_until_not_state "$server" "active"
sudo systemctl start "$server"
- wait_until_ready "$server" "$PORT"
+ wait_until_ready "$server" "$PORT" "$CONTEXT_PATH"
sudo systemctl status "$server"
fi
View it on GitLab: https://salsa.debian.org/java-team/css-validator/-/commit/2e6e892640297704292e9cae9a91b1fd47bcd9b4
--
View it on GitLab: https://salsa.debian.org/java-team/css-validator/-/commit/2e6e892640297704292e9cae9a91b1fd47bcd9b4
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20260303/95397352/attachment.htm>
More information about the pkg-java-commits
mailing list