Check against PHPRedmin

This commit is contained in:
cytopia 2018-12-16 00:34:59 +01:00
parent a459597759
commit 178a81c24b
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2

@ -0,0 +1,41 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
#
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
#
###
### Ensure PHPRedmin works
###
URL="/vendor/phpredmin/public/index.php"
printf "[TEST] Fetch ${URL}"
# 1st Try
if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "Strings|Hashes|Lists|Sets|Sorted Sets")" != "5" ]; then
# 2nd Try
sleep 1
if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "Strings|Hashes|Lists|Sets|Sorted Sets")" != "5" ]; then
# 3rd Try
sleep 1
if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "Strings|Hashes|Lists|Sets|Sorted Sets")" != "5" ]; then
printf "\r[FAIL] Fetch ${URL}\n"
curl -sS localhost/${URL} || true
curl -sSI localhost/${URL} || true
exit 1
else
printf "\r[OK] Fetch ${URL} (3 rounds)\n"
fi
else
printf "\r[OK] Fetch ${URL} (2 rounds)\n"
fi
else
printf "\r[OK] Fetch ${URL} (1 round)\n"
fi