#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" # shellcheck source=scripts/e2e-lib.sh source "${ROOT}/scripts/e2e-lib.sh" cd "$ROOT" GATEWAY_PORT="${GATEWAY_PORT:-18888}" PID_FILE="${PID_FILE:-${ROOT}/test/e2e/fixtures/gateway.pid}" e2e_stop_gateway "${GATEWAY_PORT}" "${PID_FILE}" if command -v lsof >/dev/null 2>&1 && lsof -ti tcp:"${GATEWAY_PORT}" >/dev/null 2>&1; then echo "e2e-down: warning — port ${GATEWAY_PORT} still in use" >&2 lsof -i tcp:"${GATEWAY_PORT}" >&2 || true exit 1 fi # --profile smtp 涵蓋一般 + mailhog;docker compose 對未掛起的 profile 是 no-op,安全。 docker compose --profile smtp down -v e2e_ok "e2e-down OK(gateway stopped, docker cleaned)"