2018-12-10 19:21:44 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
|
2018-12-15 21:58:29 +00:00
|
|
|
#
|
|
|
|
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
|
|
|
|
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2018-12-10 19:21:44 +00:00
|
|
|
printf "[TEST] devilbox-version key in Memcached"
|
|
|
|
# 1st Try
|
2018-12-15 21:58:29 +00:00
|
|
|
if ! curl -sS localhost/db_memcd.php | tac | tac | grep -q 'devilbox-version'; then
|
2018-12-10 19:21:44 +00:00
|
|
|
sleep 1
|
2018-12-15 21:58:29 +00:00
|
|
|
if ! curl -sS localhost/db_memcd.php | tac | tac | grep -q 'devilbox-version'; then
|
2018-12-10 19:21:44 +00:00
|
|
|
sleep 1
|
2018-12-15 21:58:29 +00:00
|
|
|
if ! curl -sS localhost/db_memcd.php | tac | tac | grep -q 'devilbox-version'; then
|
2018-12-10 19:21:44 +00:00
|
|
|
printf "\r[FAIL] devilbox-version key in Memcached\n"
|
|
|
|
curl -sS localhost/db_memcd.php || true
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
printf "\r[OK] devilbox-version key in Memcached (3 rounds)\n"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
printf "\r[OK] devilbox-version key in Memcached (2 rounds)\n"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
printf "\r[OK] devilbox-version key in Memcached (1 round)\n"
|
|
|
|
fi
|