#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" cleanup() { echo "Cleaning up..." docker compose -f "$PROJECT_ROOT/docker-compose.test.yml" down -v --remove-orphans 2>/dev/null || true } trap cleanup EXIT UNIT_ONLY=false for arg in "$@"; do case "$arg" in --unit-only) UNIT_ONLY=true ;; esac done echo "=== Running unit tests ===" cd "$PROJECT_ROOT" dotnet restore dotnet test Azaion.Test/ --configuration Release --verbosity normal --logger "console;verbosity=normal" if [ "$UNIT_ONLY" = true ]; then echo "=== Unit-only mode — skipping blackbox tests ===" exit 0 fi echo "=== Building and starting test environment ===" docker compose -f "$PROJECT_ROOT/docker-compose.test.yml" up --build --abort-on-container-exit --exit-code-from e2e-consumer echo "=== All tests passed ==="