#!/usr/bin/env bash # crm-new 冒烟:三组件健康 + bridge 鉴权/验证门控 set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT" # shellcheck disable=SC1091 set -a; . ./.env; set +a say() { printf '\n== %s ==\n' "$1"; } code() { curl -s -o /tmp/crmnew-smoke.out -w '%{http_code}' "$@" || true; } say "LibreDesk /health" echo "HTTP $(code http://localhost:9000/health) $(head -c 120 /tmp/crmnew-smoke.out 2>/dev/null)" say "Twenty /healthz" echo "HTTP $(code http://localhost:3100/healthz)" say "bridge /healthz" echo "HTTP $(code http://localhost:4100/healthz) $(head -c 200 /tmp/crmnew-smoke.out 2>/dev/null)" say "bridge manifest" echo "HTTP $(code -H "X-Tools-Key: ${TOOLS_SHARED_KEY}" http://localhost:4100/tools/manifest)" python3 -c "import json;d=json.load(open('/tmp/crmnew-smoke.out'));print('tools:',[t['name'] for t in d['tools']])" 2>/dev/null || true say "search_products(未验证,应 200)" echo "HTTP $(code -X POST http://localhost:4100/tools/search_products \ -H "X-Tools-Key: ${TOOLS_SHARED_KEY}" -H 'Content-Type: application/json' \ -d '{"query":"gold hoop earrings"}')" say "search_orders(未验证,应 403)" echo "HTTP $(code -X POST http://localhost:4100/tools/search_orders \ -H "X-Tools-Key: ${TOOLS_SHARED_KEY}" -H 'Content-Type: application/json' -d '{}')" rm -f /tmp/crmnew-smoke.out echo echo "冒烟完成。"