From 40ac7307198a800e2b715ce401e5193b0b5c6b38 Mon Sep 17 00:00:00 2001 From: MDietermann Date: Mon, 13 Apr 2026 21:22:29 +0200 Subject: [PATCH] test(integration): run archduino install end-to-end on archlinux:base --- test/integration/Dockerfile | 16 ++++++++++++++++ test/integration/run.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 test/integration/Dockerfile create mode 100755 test/integration/run.sh diff --git a/test/integration/Dockerfile b/test/integration/Dockerfile new file mode 100644 index 0000000..70710ff --- /dev/null +++ b/test/integration/Dockerfile @@ -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"] diff --git a/test/integration/run.sh b/test/integration/run.sh new file mode 100755 index 0000000..f6cd17d --- /dev/null +++ b/test/integration/run.sh @@ -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"