Integration tests for Redis and Memcached UI

This commit is contained in:
cytopia 2018-12-10 20:21:44 +01:00
parent c143eac015
commit 01cdfca7fb
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
3 changed files with 56 additions and 0 deletions

View File

@ -17,9 +17,11 @@ printf "[TEST] dvlbox-ok"
TEST_OK="$( curl -sS localhost/index.php | grep -c 'dvlbox-ok' || true )" TEST_OK="$( curl -sS localhost/index.php | grep -c 'dvlbox-ok' || true )"
if [ "${TEST_OK}" != "${NUM_OK}" ]; then if [ "${TEST_OK}" != "${NUM_OK}" ]; then
# 2nd Try # 2nd Try
sleep 1
TEST_OK="$( curl -sS localhost/index.php | grep -c 'dvlbox-ok' || true )" TEST_OK="$( curl -sS localhost/index.php | grep -c 'dvlbox-ok' || true )"
if [ "${TEST_OK}" != "${NUM_OK}" ]; then if [ "${TEST_OK}" != "${NUM_OK}" ]; then
# 3rd Try # 3rd Try
sleep 1
TEST_OK="$( curl -sS localhost/index.php | grep -c 'dvlbox-ok' || true )" TEST_OK="$( curl -sS localhost/index.php | grep -c 'dvlbox-ok' || true )"
if [ "${TEST_OK}" != "${NUM_OK}" ]; then if [ "${TEST_OK}" != "${NUM_OK}" ]; then
printf "\r[FAIL] dvlbox-ok\n" printf "\r[FAIL] dvlbox-ok\n"
@ -45,9 +47,11 @@ printf "[TEST] dvlbox-err"
TEST_ERR="$( curl -sS localhost/index.php | grep -c 'dvlbox-err' || true )" TEST_ERR="$( curl -sS localhost/index.php | grep -c 'dvlbox-err' || true )"
if [ "${TEST_ERR}" != "${NUM_ERR}" ]; then if [ "${TEST_ERR}" != "${NUM_ERR}" ]; then
# 2nd Try # 2nd Try
sleep 1
TEST_ERR="$( curl -sS localhost/index.php | grep -c 'dvlbox-err' || true )" TEST_ERR="$( curl -sS localhost/index.php | grep -c 'dvlbox-err' || true )"
if [ "${TEST_ERR}" != "${NUM_ERR}" ]; then if [ "${TEST_ERR}" != "${NUM_ERR}" ]; then
# 3rd Try # 3rd Try
sleep 1
TEST_ERR="$( curl -sS localhost/index.php | grep -c 'dvlbox-err' || true )" TEST_ERR="$( curl -sS localhost/index.php | grep -c 'dvlbox-err' || true )"
if [ "${TEST_ERR}" != "${NUM_ERR}" ]; then if [ "${TEST_ERR}" != "${NUM_ERR}" ]; then
printf "\r[FAIL] dvlbox-err\n" printf "\r[FAIL] dvlbox-err\n"

26
.tests/intra-tests/memcached.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
printf "[TEST] devilbox-version key in Memcached"
# 1st Try
if ! curl -sS localhost/db_memcd.php | grep -q 'devilbox-version'; then
sleep 1
if ! curl -sS localhost/db_memcd.php | grep -q 'devilbox-version'; then
sleep 1
if ! curl -sS localhost/db_memcd.php | grep -q 'devilbox-version'; then
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

26
.tests/intra-tests/redis.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
printf "[TEST] devilbox-version key in Redis"
# 1st Try
if ! curl -sS localhost/db_redis.php | grep -q 'devilbox-version'; then
sleep 1
if ! curl -sS localhost/db_redis.php | grep -q 'devilbox-version'; then
sleep 1
if ! curl -sS localhost/db_redis.php | grep -q 'devilbox-version'; then
printf "\r[FAIL] devilbox-version key in Redis\n"
curl -sS localhost/db_redis.php || true
exit 1
else
printf "\r[OK] devilbox-version key in Redis (3 rounds)\n"
fi
else
printf "\r[OK] devilbox-version key in Redis (2 rounds)\n"
fi
else
printf "\r[OK] devilbox-version key in Redis (1 round)\n"
fi