smoke-test: replace ((VAR++)) with VAR=$((VAR+1)) to avoid set -e exit
((VAR++)) returns the OLD value, so when PASS=0 the first ✅ check
caused exit code 1, killing the script under set -e. Use VAR=$((VAR+1))
which always returns 0. Same pattern as opencode-devbox's smoke-test.
This commit is contained in:
@@ -22,9 +22,9 @@ SIZE_THRESHOLD_MB=2200
|
||||
run() {
|
||||
local label="$1"; local cmd="$2"
|
||||
if docker run --rm --entrypoint="" "$IMAGE" sh -c "$cmd" >/dev/null 2>&1; then
|
||||
printf " ✅ %s\n" "$label"; ((PASS++))
|
||||
printf " ✅ %s\n" "$label"; PASS=$((PASS+1))
|
||||
else
|
||||
printf " ❌ %s\n" "$label"; ((FAIL++))
|
||||
printf " ❌ %s\n" "$label"; FAIL=$((FAIL+1))
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ done
|
||||
exec_test() {
|
||||
local label="$1"; local cmd="$2"
|
||||
if docker exec "$CID" sh -c "$cmd" >/dev/null 2>&1; then
|
||||
printf " ✅ %s\n" "$label"; ((PASS++))
|
||||
printf " ✅ %s\n" "$label"; PASS=$((PASS+1))
|
||||
else
|
||||
printf " ❌ %s\n" "$label"; ((FAIL++))
|
||||
printf " ❌ %s\n" "$label"; FAIL=$((FAIL+1))
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ echo ""
|
||||
echo "── Image size ──"
|
||||
SIZE_MB=$(docker image inspect "$IMAGE" --format='{{.Size}}' | awk '{printf "%d", $1/1048576}')
|
||||
if [ "$SIZE_MB" -le "$SIZE_THRESHOLD_MB" ]; then
|
||||
printf " ✅ size: %d MB (threshold %d MB)\n" "$SIZE_MB" "$SIZE_THRESHOLD_MB"; ((PASS++))
|
||||
printf " ✅ size: %d MB (threshold %d MB)\n" "$SIZE_MB" "$SIZE_THRESHOLD_MB"; PASS=$((PASS+1))
|
||||
else
|
||||
printf " ❌ size: %d MB exceeds threshold %d MB\n" "$SIZE_MB" "$SIZE_THRESHOLD_MB"; ((FAIL++))
|
||||
printf " ❌ size: %d MB exceeds threshold %d MB\n" "$SIZE_MB" "$SIZE_THRESHOLD_MB"; FAIL=$((FAIL+1))
|
||||
fi
|
||||
|
||||
# ── Summary ───────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user