ARTIFACT-STORE-WP-0007 D7.2: deterministic local MinIO fixture, live compatibility pass

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 11:13:03 +02:00
parent 8f454da406
commit 83ce888e78
3 changed files with 80 additions and 2 deletions

58
scripts/minio_local_smoke.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/usr/bin/env bash
# minio_local_smoke.sh — deterministic local MinIO fixture for `make test-minio`
# (ARTIFACT-STORE-WP-0007 D7.2)
#
# Starts a throwaway MinIO container with generated one-run credentials,
# creates a smoke bucket, runs the live compatibility tests against it, and
# tears the container down. No external endpoint, no persistent credentials.
#
# Usage:
# bash scripts/minio_local_smoke.sh # or: make test-minio-local
#
# Environment overrides:
# MINIO_IMAGE (default: minio/minio:latest)
# MINIO_PORT (default: 19000, bound to 127.0.0.1 only)
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
MINIO_IMAGE="${MINIO_IMAGE:-minio/minio:latest}"
MINIO_PORT="${MINIO_PORT:-19000}"
CONTAINER="artifactstore-minio-smoke-$$"
BUCKET="artifactstore-smoke"
ACCESS_KEY="smoke-$(openssl rand -hex 8)"
SECRET_KEY="$(openssl rand -hex 24)"
cleanup() { docker rm -f "$CONTAINER" >/dev/null 2>&1 || true; }
trap cleanup EXIT
echo "[minio-smoke] starting $MINIO_IMAGE on 127.0.0.1:$MINIO_PORT ..."
docker run -d --name "$CONTAINER" \
-p "127.0.0.1:${MINIO_PORT}:9000" \
-e MINIO_ROOT_USER="$ACCESS_KEY" \
-e MINIO_ROOT_PASSWORD="$SECRET_KEY" \
"$MINIO_IMAGE" server /data >/dev/null
for _ in $(seq 1 30); do
if curl -sf "http://127.0.0.1:${MINIO_PORT}/minio/health/live" >/dev/null; then
break
fi
sleep 1
done
curl -sf "http://127.0.0.1:${MINIO_PORT}/minio/health/live" >/dev/null \
|| { echo "[minio-smoke] ERROR: MinIO did not become healthy" >&2; exit 1; }
echo "[minio-smoke] health/live OK"
docker exec "$CONTAINER" sh -c \
'mc alias set local http://127.0.0.1:9000 "$MINIO_ROOT_USER" "$MINIO_ROOT_PASSWORD" >/dev/null && mc mb local/'"$BUCKET" >/dev/null
echo "[minio-smoke] bucket $BUCKET created"
cd "$REPO_ROOT"
ARTIFACTSTORE_MINIO_ENDPOINT_URL="http://127.0.0.1:${MINIO_PORT}" \
ARTIFACTSTORE_MINIO_ACCESS_KEY="$ACCESS_KEY" \
ARTIFACTSTORE_MINIO_SECRET_KEY="$SECRET_KEY" \
ARTIFACTSTORE_MINIO_BUCKET="$BUCKET" \
make test-minio
echo "[minio-smoke] PASS — live MinIO round-trip/range/multipart compatibility verified"