Test startup files

This commit is contained in:
cytopia 2018-12-27 13:16:30 +01:00
parent ddbe0f9bb6
commit cb7ec86765
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
2 changed files with 50 additions and 1 deletions

View File

@ -144,7 +144,8 @@ info:
###
### Run tests
###
test: test-vhost test-intra
test: test-vhost test-intra test-startup
test-intra:
@echo "####################################################################################################"
@ -278,6 +279,16 @@ test-vhost:
@echo
test-startup:
@echo "####################################################################################################"
@echo "# RUNNING TESTS: STARTUP"
@echo "####################################################################################################"
@echo
@if ! $(CURRENT_PATH)startup-tests/startup.sh; then \
exit 1; \
fi
# -------------------------------------------------------------------------------------------------
# Helper Targets
# -------------------------------------------------------------------------------------------------

38
.tests/startup-tests/startup.sh Executable file
View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
COMPOSEPATH="${SCRIPTPATH}/../../"
CONTAINER="$( cd "${COMPOSEPATH}" && docker-compose ps -q php )"
#FILES="$()"
cd "${COMPOSEPATH}" && docker-compose exec -T php bash -c "find /startup.d/*.sh-example -type f -print0 2>/dev/null" \
| xargs -0 -n 1 echo \
| while read f; do
echo "# ----------------------------------------------------------------------------------------"
echo "# [TEST] ${f}"
echo "# ----------------------------------------------------------------------------------------"
if ! docker exec -t ${CONTAINER} bash "${f}"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}"; then
sleep 5
if ! docker exec -t ${CONTAINER} bash "${f}"; then
echo "[FAIl] ${f}"
exit 1
fi
fi
fi
fi
fi
echo "[OK] ${f}"
echo
echo
done