aboutsummaryrefslogtreecommitdiffstats
path: root/image-builder/test-image-builder.sh
diff options
context:
space:
mode:
Diffstat (limited to 'image-builder/test-image-builder.sh')
-rwxr-xr-ximage-builder/test-image-builder.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/image-builder/test-image-builder.sh b/image-builder/test-image-builder.sh
index 19f3ff8..fe6cff6 100755
--- a/image-builder/test-image-builder.sh
+++ b/image-builder/test-image-builder.sh
@@ -83,6 +83,18 @@ DOCKER_RC=0
( require_docker ) 2>/dev/null; check_rc "require_docker daemon up" 0 $?
unset -f docker
+# --- docker_build: one retry, then give up ---
+# Stub fails the first FAILS calls, counting attempts in a file (the calls run
+# in $() subshells, so a shell variable would not survive).
+docker() { local n; n=$(( $(cat "$tmp/calls") + 1 )); echo "$n" > "$tmp/calls"; (( n > FAILS )); }
+for FAILS in 0 1 2; do
+ echo 0 > "$tmp/calls"
+ ( docker_build -t x . ) 2>/dev/null; rc=$?
+ check_rc "docker_build rc after $FAILS failures" "$(( FAILS > 1 ))" "$rc"
+ check "docker_build attempts after $FAILS failures" "$(( FAILS > 1 ? 2 : FAILS + 1 ))" "$(cat "$tmp/calls")"
+done
+unset -f docker
+
# --- registry-gc.sh: -V / --help parse without touching docker; syntax valid ---
gc_ver="$(sed -n 's/^PROJECT_VERSION="\([^"]*\)".*/\1/p' registry-gc.sh)"
check "registry-gc.sh -V" "registry-gc.sh $gc_ver" "$(bash ./registry-gc.sh -V)"