29 lines
756 B
Bash
Executable File
29 lines
756 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
BASE_URL="${1:-http://127.0.0.1:8787}"
|
|
|
|
require_ok() {
|
|
local json="$1"
|
|
if ! printf '%s' "$json" | rg -q '"ok"\s*:\s*true'; then
|
|
printf 'Smoke failed: expected ok=true, got: %s\n' "$json" >&2
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
config_json="$(curl -fsS "$BASE_URL/api/config")"
|
|
require_ok "$config_json"
|
|
|
|
issues_json="$(curl -fsS "$BASE_URL/api/issues?status=active&limit=5")"
|
|
require_ok "$issues_json"
|
|
|
|
parse_json="$(curl -fsS -X POST "$BASE_URL/api/parse" \
|
|
-H 'Content-Type: application/json' \
|
|
--data '{"raw_text":"#接龙\n1、营江路揽收现金10万存一年"}')"
|
|
require_ok "$parse_json"
|
|
|
|
history_json="$(curl -fsS "$BASE_URL/api/history/view?limit=5")"
|
|
require_ok "$history_json"
|
|
|
|
echo "Smoke passed: $BASE_URL"
|