#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" cleanup() { docker compose -f "$PROJECT_ROOT/docker-compose.yml" -f "$PROJECT_ROOT/docker-compose.tests.yml" down --remove-orphans 2>/dev/null || true } trap cleanup EXIT echo "=== Satellite Provider Test Suite ===" echo "" if [[ "${1:-}" == "--unit-only" ]]; then echo "Running unit tests only..." docker run --rm -v "$PROJECT_ROOT:/src" -w /src mcr.microsoft.com/dotnet/sdk:8.0 \ dotnet test SatelliteProvider.Tests/SatelliteProvider.Tests.csproj \ --no-restore --configuration Release \ --logger "console;verbosity=normal" echo "" echo "=== Unit tests complete ===" exit 0 fi echo "Running full test suite (unit + integration)..." echo "" echo "Step 1: Unit tests" docker run --rm -v "$PROJECT_ROOT:/src" -w /src mcr.microsoft.com/dotnet/sdk:8.0 \ sh -c "dotnet restore SatelliteProvider.sln && dotnet test SatelliteProvider.Tests/SatelliteProvider.Tests.csproj --no-restore --configuration Release --logger 'console;verbosity=normal'" echo "" echo "Step 2: Integration tests (Docker Compose)" docker compose -f "$PROJECT_ROOT/docker-compose.yml" -f "$PROJECT_ROOT/docker-compose.tests.yml" \ up --build --abort-on-container-exit --exit-code-from integration-tests echo "" echo "=== All tests passed ==="