diff --git a/tests/00.sh b/tests/00-test-html.sh
similarity index 56%
rename from tests/00.sh
rename to tests/00-test-html.sh
index 9dd8d18..116353f 100755
--- a/tests/00.sh
+++ b/tests/00-test-html.sh
@@ -13,6 +13,8 @@ TAG="${4}"
ARCH="${5}"
+HOST_PORT="8093"
+
###
### Load Library
###
@@ -26,7 +28,7 @@ ARCH="${5}"
###
RAND_DIR="$( mktemp -d )"
RAND_NAME="$( get_random_name )"
-run "echo \"hello world\" > ${RAND_DIR}/index.html"
+run "echo \"hello world via html\" > ${RAND_DIR}/index.html"
###
@@ -34,7 +36,7 @@ run "echo \"hello world\" > ${RAND_DIR}/index.html"
###
run "docker run --rm --platform ${ARCH} \
-v ${RAND_DIR}:/var/www/default/htdocs \
- -p 127.0.0.1:80:80 \
+ -p 127.0.0.1:${HOST_PORT}:80 \
-e DEBUG_ENTRYPOINT=2 \
-e DEBUG_RUNTIME=1 \
-e NEW_UID=$( id -u ) \
@@ -45,20 +47,22 @@ run "docker run --rm --platform ${ARCH} \
###
### Tests
###
-run "sleep 20" # Startup-time is longer on cross-platform
-run "docker ps"
-if ! run "docker logs ${RAND_NAME}"; then
- exit 1
-fi
-if ! run "curl -sS localhost/index.html"; then
- run "docker stop ${RAND_NAME}"
- exit 1
-fi
-if ! run "curl -sS localhost/index.html | grep 'hello world'"; then
- run "docker stop ${RAND_NAME}"
- exit 1
-fi
-
+WAIT=120
+INDEX=0
+printf "Testing connectivity"
+while ! curl -sS "http://localhost:${HOST_PORT}" 2>/dev/null | grep 'hello world via html'; do
+ printf "."
+ if [ "${INDEX}" = "${WAIT}" ]; then
+ printf "\\n"
+ run "docker logs ${RAND_NAME}" || true
+ run "docker stop ${RAND_NAME}" || true
+ echo "Error"
+ exit 1
+ fi
+ INDEX=$(( INDEX + 1 ))
+ sleep 1
+done
+printf "\\n[OK] Test success\\n"
###
### Cleanup
diff --git a/tests/01-test-php.sh b/tests/01-test-php.sh
new file mode 100755
index 0000000..3a34141
--- /dev/null
+++ b/tests/01-test-php.sh
@@ -0,0 +1,85 @@
+#!/usr/bin/env bash
+
+set -e
+set -u
+set -o pipefail
+
+CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
+
+IMAGE="${1}"
+#NAME="${2}"
+#VERSION="${3}"
+TAG="${4}"
+ARCH="${5}"
+
+
+HOST_PORT="8093"
+
+###
+### Load Library
+###
+# shellcheck disable=SC1091
+. "${CWD}/.lib.sh"
+
+
+
+###
+### Preparation
+###
+RAND_DIR="$( mktemp -d )"
+RAND_NAME1="$( get_random_name )"
+RAND_NAME2="$( get_random_name )"
+run "chmod 0755 ${RAND_DIR}"
+run "echo \" ${RAND_DIR}/index.php"
+
+
+###
+### Startup container
+###
+run "docker run -d --rm --platform ${ARCH} \
+ -v ${RAND_DIR}:/var/www/default/htdocs \
+ --name ${RAND_NAME1} \
+ devilbox/php-fpm-8.1"
+
+run "docker run --rm --platform ${ARCH} \
+ -v ${RAND_DIR}:/var/www/default/htdocs \
+ -p 127.0.0.1:${HOST_PORT}:80 \
+ -e DEBUG_ENTRYPOINT=2 \
+ -e DEBUG_RUNTIME=1 \
+ -e NEW_UID=$( id -u ) \
+ -e NEW_GID=$( id -g ) \
+ -e PHP_FPM_ENABLE=1 \
+ -e PHP_FPM_SERVER_ADDR=${RAND_NAME1} \
+ -e PHP_FPM_SERVER_PORT=9000 \
+ --link ${RAND_NAME1} \
+ --name ${RAND_NAME2} \
+ ${IMAGE}:${TAG} &"
+
+
+###
+### Tests
+###
+WAIT=120
+INDEX=0
+printf "Testing connectivity"
+while ! curl -sS "http://localhost:${HOST_PORT}" 2>/dev/null | grep 'hello world php'; do
+ printf "."
+ if [ "${INDEX}" = "${WAIT}" ]; then
+ printf "\\n"
+ run "docker logs ${RAND_NAME1}" || true
+ run "docker logs ${RAND_NAME2}" || true
+ run "docker stop ${RAND_NAME1}" || true
+ run "docker stop ${RAND_NAME2}" || true
+ echo "Error"
+ exit 1
+ fi
+ INDEX=$(( INDEX + 1 ))
+ sleep 1
+done
+printf "\\n[OK] Test success\\n"
+
+###
+### Cleanup
+###
+run "docker stop ${RAND_NAME1}"
+run "docker stop ${RAND_NAME2}"
diff --git a/tests/01.sh b/tests/02-timezone.sh
similarity index 60%
rename from tests/01.sh
rename to tests/02-timezone.sh
index 3d9e3e5..6dbc280 100755
--- a/tests/01.sh
+++ b/tests/02-timezone.sh
@@ -13,6 +13,8 @@ TAG="${4}"
ARCH="${5}"
+HOST_PORT="8093"
+
###
### Load Library
###
@@ -38,37 +40,42 @@ run "docker run -d --rm --platform ${ARCH} \
-v ${RAND_DIR}:/var/www/default/htdocs \
--name ${RAND_NAME1} devilbox/php-fpm-8.1"
-run "docker run -d --rm --platform ${ARCH} \
+run "docker run --rm --platform ${ARCH} \
-v ${RAND_DIR}:/var/www/default/htdocs \
- -p 127.0.0.1:80:80 \
+ -p 127.0.0.1:${HOST_PORT}:80 \
-e DEBUG_ENTRYPOINT=2 \
-e DEBUG_RUNTIME=1 \
+ -e TIMEZONE=Europe/Berlin \
-e NEW_UID=$( id -u ) \
-e NEW_GID=$( id -g ) \
-e PHP_FPM_ENABLE=1 \
-e PHP_FPM_SERVER_ADDR=${RAND_NAME1} \
-e PHP_FPM_SERVER_PORT=9000 \
--link ${RAND_NAME1} \
- --name ${RAND_NAME2} ${IMAGE}:${TAG}"
+ --name ${RAND_NAME2} ${IMAGE}:${TAG} &"
###
### Tests
###
-run "sleep 20" # Startup-time is longer on cross-platform
-run "docker ps"
-run "docker logs ${RAND_NAME1}"
-run "docker logs ${RAND_NAME2}"
-if ! run "curl localhost"; then
- run "docker stop ${RAND_NAME1}"
- run "docker stop ${RAND_NAME2}"
- exit 1
-fi
-if ! run "curl localhost | grep 'hello world php'"; then
- run "docker stop ${RAND_NAME1}"
- run "docker stop ${RAND_NAME2}"
- exit 1
-fi
+WAIT=120
+INDEX=0
+printf "Testing connectivity"
+while ! curl -sS "http://localhost:${HOST_PORT}" 2>/dev/null | grep 'hello world php'; do
+ printf "."
+ if [ "${INDEX}" = "${WAIT}" ]; then
+ printf "\\n"
+ run "docker logs ${RAND_NAME1}" || true
+ run "docker logs ${RAND_NAME2}" || true
+ run "docker stop ${RAND_NAME1}" || true
+ run "docker stop ${RAND_NAME2}" || true
+ echo "Error"
+ exit 1
+ fi
+ INDEX=$(( INDEX + 1 ))
+ sleep 1
+done
+printf "\\n[OK] Test success\\n"
###
### Cleanup
diff --git a/tests/start-ci.sh b/tests/start-ci.sh
index 1777030..bdd8a48 100755
--- a/tests/start-ci.sh
+++ b/tests/start-ci.sh
@@ -43,6 +43,8 @@ else
echo "################################################################################"
echo "# [${CWD}/${i}] ${IMAGE}:${TAG} ${NAME}-${VERSION} (${ARCH})"
echo "################################################################################"
- sh -c "${i} ${IMAGE} ${NAME} ${VERSION} ${TAG} ${ARCH}"
+ if ! sh -c "${i} ${IMAGE} ${NAME} ${VERSION} ${TAG} ${ARCH}"; then
+ exit 1
+ fi
done
fi