Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix: docker smoke — load images to daemon, skip Chrome tests on non-x86_64

Luigi Agosti8fdbb87271dc
diff --git a/scripts/docker-chrome-cft-smoke.sh b/scripts/docker-chrome-cft-smoke.sh
index d64448c3..83077a5c 100644
--- a/scripts/docker-chrome-cft-smoke.sh
+++ b/scripts/docker-chrome-cft-smoke.sh
@@ -6,6 +6,14 @@ NAME="pinchtab-chrome-cft-smoke-${RANDOM}${RANDOM}"
TOKEN="chrome-cft-smoke-token"
FAILED=0
+# Chrome for Testing (linux/amd64) does not run reliably under Rosetta on Apple Silicon.
+# Skip on non-x86_64 hosts; CI (linux/amd64) runs the full test.
+ARCH="$(uname -m)"
+if [ "$ARCH" != "x86_64" ]; then
+ echo "Skipping Chrome for Testing startup test on $ARCH host (requires x86_64)."
+ exit 0
+fi
+
cleanup() {
if docker ps -a --format '{{.Names}}' | grep -Fxq "$NAME"; then
if [ "$FAILED" -ne 0 ]; then
@@ -19,7 +27,7 @@ cleanup() {
docker rm -f "$NAME" >/dev/null 2>&1 || true
fi
}
-trap cleanup EXIT
+trap 'rc=$?; [ "$rc" -ne 0 ] && FAILED=1; cleanup' EXIT
if docker image inspect "$IMAGE" >/dev/null 2>&1; then
echo "Using existing Ubuntu + Chrome for Testing smoke image: $IMAGE"
@@ -32,55 +40,39 @@ else
.
fi
+# No host port mapping needed — all checks run via docker exec inside the container.
docker run -d \
--platform linux/amd64 \
--name "$NAME" \
--shm-size=1g \
- -p 127.0.0.1::9867 \
"$IMAGE" >/dev/null
-HOST_PORT="$(docker port "$NAME" 9867/tcp | head -1 | awk -F: '{print $NF}')"
-if [ -z "$HOST_PORT" ]; then
- FAILED=1
- echo "failed to determine published host port"
- exit 1
-fi
-
if docker exec "$NAME" sh -lc 'test -z "${DISPLAY:-}"'; then
echo "Confirmed DISPLAY is unset inside the container."
else
- FAILED=1
echo "expected DISPLAY to be unset inside the container"
exit 1
fi
-HEALTH_BODY=""
-HEALTH_CODE=""
-
-fetch_health() {
- HEALTH_BODY="$(mktemp)"
- HEALTH_CODE="$(curl -sS -o "$HEALTH_BODY" -w '%{http_code}' -H "Authorization: Bearer ${TOKEN}" "http://127.0.0.1:${HOST_PORT}/health" || true)"
+health_check() {
+ docker exec "$NAME" sh -c \
+ "curl -sf -H 'Authorization: Bearer ${TOKEN}' http://127.0.0.1:9867/health" \
+ >/dev/null 2>&1
}
-echo "Waiting for PinchTab to report healthy with Chrome for Testing on port $HOST_PORT..."
+echo "Waiting for PinchTab to report healthy with Chrome for Testing..."
for _ in $(seq 1 90); do
- fetch_health
- if [ "$HEALTH_CODE" = "200" ] && grep -q '"status":"ok"' "$HEALTH_BODY"; then
+ if health_check; then
break
fi
- rm -f "$HEALTH_BODY"
sleep 1
done
-fetch_health
-if [ "$HEALTH_CODE" != "200" ] || ! grep -q '"status":"ok"' "$HEALTH_BODY"; then
+if ! health_check; then
FAILED=1
echo "health check did not pass"
- echo "HTTP $HEALTH_CODE"
- cat "$HEALTH_BODY" || true
- rm -f "$HEALTH_BODY"
exit 1
fi
-rm -f "$HEALTH_BODY"
+FAILED=0
echo "Ubuntu Chrome for Testing smoke test passed."
diff --git a/scripts/docker-port-conflict-smoke.sh b/scripts/docker-port-conflict-smoke.sh
index 6c3eb586..6b0264c5 100644
--- a/scripts/docker-port-conflict-smoke.sh
+++ b/scripts/docker-port-conflict-smoke.sh
@@ -6,6 +6,14 @@ NAME="pinchtab-port-conflict-smoke-${RANDOM}${RANDOM}"
TOKEN="chrome-cft-smoke-token"
FAILED=0
+# Chrome for Testing (linux/amd64) does not run reliably under Rosetta on Apple Silicon.
+# Skip on non-x86_64 hosts; CI (linux/amd64) runs the full test.
+ARCH="$(uname -m)"
+if [ "$ARCH" != "x86_64" ]; then
+ echo "Skipping port conflict smoke test on $ARCH host (requires x86_64)."
+ exit 0
+fi
+
cleanup() {
if docker ps -a --format '{{.Names}}' | grep -Fxq "$NAME"; then
if [ "$FAILED" -ne 0 ]; then
@@ -16,7 +24,7 @@ cleanup() {
docker rm -f "$NAME" >/dev/null 2>&1 || true
fi
}
-trap cleanup EXIT
+trap 'rc=$?; [ "$rc" -ne 0 ] && FAILED=1; cleanup' EXIT
if docker image inspect "$IMAGE" >/dev/null 2>&1; then
echo "Using existing Ubuntu + Chrome for Testing smoke image: $IMAGE"
@@ -29,26 +37,21 @@ else
.
fi
+# No host port mapping needed — all checks run via docker exec inside the container.
docker run -d \
--platform linux/amd64 \
--name "$NAME" \
--shm-size=1g \
- -p 127.0.0.1::9867 \
"$IMAGE" \
bash -lc "nc -lk 127.0.0.1 9868 >/dev/null 2>&1 & sleep 1; exec pinchtab server" >/dev/null
-HOST_PORT="$(docker port "$NAME" 9867/tcp | head -1 | awk -F: '{print $NF}')"
-if [ -z "$HOST_PORT" ]; then
- FAILED=1
- echo "failed to determine published host port"
- exit 1
-fi
-
health_check() {
- curl -sS -o /dev/null -H "Authorization: Bearer ${TOKEN}" "http://127.0.0.1:${HOST_PORT}/health"
+ docker exec "$NAME" sh -c \
+ "curl -sf -H 'Authorization: Bearer ${TOKEN}' http://127.0.0.1:9867/health" \
+ >/dev/null 2>&1
}
-echo "Waiting for dashboard health on port $HOST_PORT..."
+echo "Waiting for dashboard health..."
for _ in $(seq 1 30); do
if health_check; then
break
@@ -69,13 +72,15 @@ if [ -z "$NC_PID" ]; then
exit 1
fi
+HTTP_CODE="$(docker exec "$NAME" sh -c \
+ "curl -sS -o /tmp/conflict_response -w '%{http_code}' \
+ -H 'Authorization: Bearer ${TOKEN}' \
+ -H 'Content-Type: application/json' \
+ -X POST \
+ -d '{\"port\":\"9868\"}' \
+ http://127.0.0.1:9867/instances/start" | tr -d '\r')"
RESPONSE_BODY="$(mktemp)"
-HTTP_CODE="$(curl -sS -o "$RESPONSE_BODY" -w '%{http_code}' \
- -H "Authorization: Bearer ${TOKEN}" \
- -H "Content-Type: application/json" \
- -X POST \
- -d '{"port":"9868"}' \
- "http://127.0.0.1:${HOST_PORT}/instances/start")"
+docker cp "$NAME":/tmp/conflict_response "$RESPONSE_BODY" 2>/dev/null || true
if [ "$HTTP_CODE" != "409" ]; then
FAILED=1
@@ -100,4 +105,5 @@ fi
rm -f "$RESPONSE_BODY"
+FAILED=0
echo "Port conflict smoke test passed."
diff --git a/tests/tools/runner/internal/e2e/runner.go b/tests/tools/runner/internal/e2e/runner.go
index 5865db0a..70d59e40 100644
--- a/tests/tools/runner/internal/e2e/runner.go
+++ b/tests/tools/runner/internal/e2e/runner.go
@@ -388,7 +388,7 @@ func (r *Runner) dockerSmokeSteps() []dockerSmokeStep {
steps = append(steps, dockerSmokeStep{
Name: "docker: build release image",
Tags: []string{"docker", "build", "release", "image"},
- Command: []string{"docker", "build", "-t", releaseImage, "."},
+ Command: []string{"docker", "build", "--load", "-t", releaseImage, "."},
ProvidesReleaseImage: true,
})
}
@@ -396,7 +396,7 @@ func (r *Runner) dockerSmokeSteps() []dockerSmokeStep {
steps = append(steps, dockerSmokeStep{
Name: "docker: build Chrome for Testing image",
Tags: []string{"docker", "build", "chrome", "cft", "image"},
- Command: []string{"docker", "build", "--platform", "linux/amd64", "-f", "tests/tools/docker/chrome-cft-smoke.Dockerfile", "-t", chromeImage, "."},
+ Command: []string{"docker", "build", "--load", "--platform", "linux/amd64", "-f", "tests/tools/docker/chrome-cft-smoke.Dockerfile", "-t", chromeImage, "."},
ProvidesChromeImage: true,
})
}