Files
Archduino/test/integration/run.sh
MDietermann 8b43a0f273 fix: address final-review findings before closing Plan 1
- privilege: wire sudo -v to real stdin/stdout/stderr so it can prompt
- cmd: validate --only/--skip IDs against registry (prevents silent
  run-all on typo); gate install to Arch-only (spec requirement);
  mark --only and --skip mutually exclusive
- platform: Pacman.Update now runs -Syu --noconfirm, not -Sy (avoids
  Arch partial-upgrade anti-pattern)
- test/integration: trap-clean the named docker volume on any exit
- go.mod: tidy — yaml.v3 is a direct dep
2026-04-13 21:35:14 +02:00

29 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build the image and run `archduino install --no-tui --no-sudo` end-to-end.
# Exits non-zero on any failure. Intended for local dev + Plan 4 CI.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
IMAGE=archduino-integration:latest
echo "--- building image"
docker build -f "$SCRIPT_DIR/Dockerfile" -t "$IMAGE" "$REPO_ROOT"
echo "--- run 1: fresh install"
docker run --rm "$IMAGE" install --no-tui --no-sudo
echo "--- run 2: idempotent (marker already present)"
# Persist home across runs via a named volume. Clean up on any exit so a
# failed assertion doesn't leak the volume to the next run.
VOL=archduino-integration-home
trap 'docker volume rm "$VOL" >/dev/null 2>&1 || true' EXIT
docker volume create "$VOL" >/dev/null
docker run --rm -v "$VOL":/home/tester "$IMAGE" install --no-tui --no-sudo
docker run --rm -v "$VOL":/home/tester "$IMAGE" install --no-tui --no-sudo
echo "--- assert marker exists in volume"
docker run --rm -v "$VOL":/home/tester --entrypoint test "$IMAGE" -f /home/tester/.cache/archduino/hello.ok
echo "--- integration test PASSED"