template-monorepo/scripts/e2e-down.sh

23 lines
749 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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 涵蓋一般 + mailhogdocker compose 對未掛起的 profile 是 no-op安全。
docker compose --profile smtp down -v
e2e_ok "e2e-down OKgateway stopped, docker cleaned"