test(integration): run archduino install end-to-end on archlinux:base
This commit is contained in:
16
test/integration/Dockerfile
Normal file
16
test/integration/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Minimal Arch image with Go toolchain for building and running archduino.
|
||||||
|
FROM archlinux:base
|
||||||
|
|
||||||
|
RUN pacman -Sy --noconfirm --needed go git ca-certificates
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . /src
|
||||||
|
|
||||||
|
RUN go build -o /usr/local/bin/archduino ./cmd/archduino
|
||||||
|
|
||||||
|
# Run as non-root to exercise user-home paths.
|
||||||
|
RUN useradd -m tester
|
||||||
|
USER tester
|
||||||
|
WORKDIR /home/tester
|
||||||
|
|
||||||
|
ENTRYPOINT ["archduino"]
|
||||||
27
test/integration/run.sh
Executable file
27
test/integration/run.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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.
|
||||||
|
VOL=archduino-integration-home
|
||||||
|
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
|
||||||
|
|
||||||
|
docker volume rm "$VOL" >/dev/null
|
||||||
|
echo "--- integration test PASSED"
|
||||||
Reference in New Issue
Block a user