#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" SCRIPT="$ROOT_DIR/scripts/acceptance/verify_user_key_self_service.sh" fail() { echo "FAIL: $*" >&2 exit 1 } assert_contains() { local haystack="$1" local needle="$2" if [[ "$haystack" != *"$needle"* ]]; then fail "expected to find [$needle] in [$haystack]" fi } [[ -f "$SCRIPT" ]] || fail "missing $SCRIPT" help_output="$(bash "$SCRIPT" --help)" assert_contains "$help_output" "verify_user_key_self_service.sh" assert_contains "$help_output" "--env-check" assert_contains "$help_output" "--run" assert_contains "$help_output" "USER_CHAT_BASE" tmpdir="$(mktemp -d)" trap 'rm -rf "$tmpdir"' EXIT fakebin="$tmpdir/bin" mkdir -p "$fakebin" cat > "$fakebin/curl" <<'EOF' #!/usr/bin/env bash set -euo pipefail url="${@: -1}" case "$url" in https://crm.example.com/healthz) printf 'ok' ;; https://chat.example.com/healthz) printf '