fix: handle unset crond_line (nounset crash) and improve test diagnostics
Docker Build and Push / lint (push) Successful in 8s
Docker Build and Push / lint (pull_request) Successful in 6s
Docker Build and Push / build (pull_request) Successful in 12s
Docker Build and Push / build (push) Successful in 17s
Docker Build and Push / test (pull_request) Successful in 15s
Docker Build and Push / test (push) Successful in 15s
Docker Build and Push / push (pull_request) Has been skipped
Docker Build and Push / push (push) Successful in 17s
Docker Build and Push / lint (push) Successful in 8s
Docker Build and Push / lint (pull_request) Successful in 6s
Docker Build and Push / build (pull_request) Successful in 12s
Docker Build and Push / build (push) Successful in 17s
Docker Build and Push / test (pull_request) Successful in 15s
Docker Build and Push / test (push) Successful in 15s
Docker Build and Push / push (pull_request) Has been skipped
Docker Build and Push / push (push) Successful in 17s
This commit is contained in:
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
set -o pipefail -o nounset -o errexit
|
set -o pipefail -o nounset -o errexit
|
||||||
|
|
||||||
echo "${crond_line}" > "/etc/crontabs/root"
|
echo "${crond_line:-}" > "/etc/crontabs/root"
|
||||||
crond -f -L /dev/stdout
|
crond -f -L /dev/stdout
|
||||||
|
|||||||
+7
-2
@@ -11,8 +11,13 @@ CONTAINER_NAME="test-crond-$$"
|
|||||||
|
|
||||||
# Test 1: Container starts and crond is running
|
# Test 1: Container starts and crond is running
|
||||||
docker run -d --name "$CONTAINER_NAME" "$IMAGE"
|
docker run -d --name "$CONTAINER_NAME" "$IMAGE"
|
||||||
sleep 3
|
sleep 4
|
||||||
if docker exec "$CONTAINER_NAME" pgrep crond > /dev/null 2>&1; then
|
if [ "$(docker inspect "$CONTAINER_NAME" --format='{{.State.Running}}')" != "true" ]; then
|
||||||
|
echo "FAIL: container exited prematurely"
|
||||||
|
echo "=== Container logs ==="
|
||||||
|
docker logs "$CONTAINER_NAME" 2>&1 || true
|
||||||
|
FAILED=$((FAILED + 1))
|
||||||
|
elif docker exec "$CONTAINER_NAME" pgrep crond > /dev/null 2>&1; then
|
||||||
echo "PASS: crond is running"
|
echo "PASS: crond is running"
|
||||||
PASSED=$((PASSED + 1))
|
PASSED=$((PASSED + 1))
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user