#!/usr/bin/env bash # Integration test for the abbaye mise plugin. # Spins up a Docker container, installs mise, registers the plugin, # lists versions, installs a given version, and verifies the binary works. # # Usage: ./scripts/test-mise-plugin.sh [version] [base-image] # version - abbaye version to install (default: 0.9.1) # base-image - Docker image (default: alpine:latest) set -euo pipefail VERSION="${1:-0.9.1}" BASE_IMAGE="${2:-alpine:latest}" REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)" PLUGIN_DIR="$REPO_DIR/.mise/plugins/abbaye" if [ ! -d "$PLUGIN_DIR/bin" ]; then echo "ERROR: plugin directory not found at $PLUGIN_DIR" exit 1 fi echo "=== Testing abbaye mise plugin ===" echo " Version: $VERSION" echo " Base image: $BASE_IMAGE" echo " Plugin dir: $PLUGIN_DIR" echo "" CONTAINER_NAME="abbaye-mise-test-$$" cleanup() { docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true } trap cleanup EXIT # Build a temporary image with the plugin baked in docker build --quiet -t "$CONTAINER_NAME" -f- "$REPO_DIR" >/dev/null <<DOCKERFILE FROM $BASE_IMAGE # Install dependencies RUN case "$BASE_IMAGE" in \ alpine*) \ apk add --no-cache bash curl xz sudo ;;\ debian*) \ apt-get update -qq && apt-get install -y -qq curl xz-utils bash && rm -rf /var/lib/apt/lists/* ;;\ fedora*) \ dnf install -y curl xz bash sudo && dnf clean all ;;\ *) \ echo "Unknown base image: $BASE_IMAGE" && exit 1 ;;\ esac # Install mise RUN curl -fsSL https://mise.jdx.dev/install.sh | sh ENV PATH="/root/.local/bin:/root/.local/share/mise/shims:\${PATH}" # Copy the abbaye plugin into mise's plugin directory COPY .mise/plugins/abbaye /root/.local/share/mise/plugins/abbaye # Accept the mise activation RUN echo "yes" | mise activate --yes 2>/dev/null || true # Test: list-all RUN echo "=== list-all ===" && mise list-all abbaye # Test: install the requested version RUN echo "=== install ===" && mise install abbaye@${VERSION} # Test: install dir has the binary RUN test -x /root/.local/share/mise/installs/abbaye/${VERSION}/abbaye && echo "=== PASS: binary exists ===" # Test: binary runs with --version RUN /root/.local/share/mise/installs/abbaye/${VERSION}/abbaye --version # Test: version matches RUN /root/.local/share/mise/installs/abbaye/${VERSION}/abbaye --version | grep -qF "$VERSION" && echo "=== PASS: version matches ===" DOCKERFILE echo "=== ALL TESTS PASSED ==="