#!/usr/bin/env bash # Functional + smoke perf E2E runner for Azaion.Annotations. # See _docs/02_document/tests/environment.md for the full design. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" COMPOSE_FILE="$PROJECT_ROOT/e2e/docker-compose.test.yml" RESULTS_DIR="$PROJECT_ROOT/test-results" UNIT_ONLY=false KEEP_STACK=false for arg in "$@"; do case "$arg" in --unit-only) UNIT_ONLY=true ;; --keep-stack) KEEP_STACK=true ;; -h|--help) cat </dev/null 2>&1 || true fi } trap cleanup EXIT if $UNIT_ONLY; then echo "[run-tests] --unit-only: skipping E2E suite (no unit tests in repo today)." exit 0 fi # Sibling fixture corpus must be reachable. fixtures_dir="$PROJECT_ROOT/../detections/_docs/00_problem/input_data" if [ ! -d "$fixtures_dir" ]; then echo "[run-tests] FATAL: fixtures dir not found at $fixtures_dir" >&2 echo "[run-tests] The annotations E2E suite reuses the detections corpus by path reference." >&2 echo "[run-tests] See _docs/00_problem/input_data/fixtures.md for the expected layout." >&2 exit 2 fi export GIT_SHA="${GIT_SHA:-$(git -C "$PROJECT_ROOT" rev-parse --short HEAD 2>/dev/null || echo local)}" export E2E_RUN_PROFILE="${E2E_RUN_PROFILE:-functional}" echo "[run-tests] profile=$E2E_RUN_PROFILE git_sha=$GIT_SHA" echo "[run-tests] starting compose stack..." # --abort-on-container-exit returns the exit code of e2e-runner via --exit-code-from. docker compose -f "$COMPOSE_FILE" up \ --build \ --abort-on-container-exit \ --exit-code-from e2e-runner # If we got here, e2e-runner exited 0. report_csv="$PROJECT_ROOT/e2e/e2e-results/report.csv" if [ -f "$report_csv" ]; then total=$(wc -l < "$report_csv" | tr -d ' ') echo "[run-tests] PASS — report: $report_csv ($total lines incl. header)" else echo "[run-tests] PASS — no CSV produced (runner did not write one)" fi exit 0