Skip to content
Snippets Groups Projects
Verified Commit 19908a09 authored by Jan Mojžíš's avatar Jan Mojžíš
Browse files

d/t/generic rework

parent 11e2e950
No related branches found
No related tags found
No related merge requests found
Pipeline #471340 passed
libnginx-mod-http-dav-ext (1:3.0.0-3) UNRELEASED; urgency=medium
* d/t/generic rework. The test now checks module after
installation/reload/restart.
-- Jan Mojžíš <jan.mojzis@gmail.com> Fri, 16 Dec 2022 04:39:48 +0100
libnginx-mod-http-dav-ext (1:3.0.0-2) unstable; urgency=medium
* d/control: added Multi-Arch: foreign
......
#!/bin/sh
set -e
# version 20221215
# generic test that only verifies that nginx is running with the given
# generic test that only verifies that nginx is running with the given
# libnginx-... module
# - after installation
# - after nginx reload
# - after nginx restart
cat <<EOF > "/etc/nginx/sites-enabled/default"
server {
listen 80 default_server;
EX=0
CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null"
location /generic {
return 200;
}
}
EOF
#change directory to $AUTOPKGTEST_TMP
cd "${AUTOPKGTEST_TMP}"
nginx -t
invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; }
echo -n "curl after installation: http status="
if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then
echo "OK"
else
EX=1
echo "FAILED"
fi
curl --fail -w "response_code: %{http_code}\n" http://127.0.0.1/generic
echo -n "nginx reload ... "
if invoke-rc.d nginx reload; then
echo "OK"
else
EX=1
echo "FAILED"
fi
sleep 5
echo -n "curl after reload: http status="
if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then
echo "OK"
else
EX=1
echo "FAILED"
fi
echo -n "nginx restart ... "
if invoke-rc.d nginx restart; then
echo "OK"
else
EX=1
echo "FAILED"
fi
sleep 5
echo -n "curl after restart: http status="
if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then
echo "OK"
else
EX=1
echo "FAILED"
fi
if [ ${EX} -ne 0 ]; then
echo "=== journalctl ==="
journalctl -n all -xu nginx.service || :
echo "=== error.log ==="
if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then
head -n 50 /var/log/nginx/error.log
echo '...'
tail -n 50 /var/log/nginx/error.log
else
cat /var/log/nginx/error.log
fi
fi
exit ${EX}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment