feat: update test.sh with proper smoke tests
Docker Build and Push / lint (pull_request) Successful in 11s
Docker Build and Push / build (pull_request) Successful in 34s
Docker Build and Push / test (pull_request) Successful in 11s
Docker Build and Push / push (pull_request) Has been skipped
Docker Build and Push / lint (push) Failing after 14m43s
Docker Build and Push / build (push) Has been skipped
Docker Build and Push / test (push) Has been skipped
Docker Build and Push / push (push) Has been skipped
Docker Build and Push / lint (pull_request) Successful in 11s
Docker Build and Push / build (pull_request) Successful in 34s
Docker Build and Push / test (pull_request) Successful in 11s
Docker Build and Push / push (pull_request) Has been skipped
Docker Build and Push / lint (push) Failing after 14m43s
Docker Build and Push / build (push) Has been skipped
Docker Build and Push / test (push) Has been skipped
Docker Build and Push / push (push) Has been skipped
This commit is contained in:
+27
-4
@@ -1,8 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IMAGE="${1:-}"
|
|
||||||
if [ -z "$IMAGE" ]; then
|
IMAGE="$1"
|
||||||
echo "Usage: $0 <image>"
|
FAILED=0
|
||||||
|
PASSED=0
|
||||||
|
|
||||||
|
# Test 1: container runs and exits
|
||||||
|
if docker run --rm "$IMAGE" --help > /dev/null 2>&1; then
|
||||||
|
echo "PASS: container runs successfully"
|
||||||
|
PASSED=$((PASSED + 1))
|
||||||
|
else
|
||||||
|
echo "FAIL: container failed to run"
|
||||||
|
FAILED=$((FAILED + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test 2: produces output
|
||||||
|
OUTPUT=$(docker run --rm "$IMAGE" --version 2>&1)
|
||||||
|
if [ -n "$OUTPUT" ]; then
|
||||||
|
echo "PASS: produces output"
|
||||||
|
PASSED=$((PASSED + 1))
|
||||||
|
else
|
||||||
|
echo "FAIL: no output"
|
||||||
|
FAILED=$((FAILED + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "$PASSED/$((PASSED + FAILED)) tests passed"
|
||||||
|
if [ "$FAILED" -gt 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
docker run --rm "$IMAGE" --version
|
|
||||||
|
|||||||
Reference in New Issue
Block a user