This commit is contained in:
Anton Afanasyeu
2026-06-23 12:21:13 +02:00
commit ca4d54fa18
30 changed files with 1400 additions and 0 deletions

28
scripts/smoke_shorten.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Minimal deploy smoke — exits non-zero on failure.
set -euo pipefail
BASE="${BASE:-https://s.f0xx.org}"
BEARER="${BEARER:-}"
echo "==> health $BASE/api/v1/health"
body="$(curl -fsS "$BASE/api/v1/health")"
echo "$body" | grep -q '"status":"ok"' || { echo "health not ok: $body"; exit 1; }
if [[ -z "$BEARER" ]]; then
echo "SKIP shorten (set BEARER to run full smoke)"
exit 0
fi
echo "==> shorten POST"
resp="$(curl -fsS -X POST "$BASE/api/v1/shorten" \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com/smoke-'"$(date +%s)"'","bearer":"'"$BEARER"'","ttl":300}')"
echo "$resp"
short="$(echo "$resp" | sed -n 's/.*"u":"\([^"]*\)".*/\1/p')"
[[ -n "$short" ]] || { echo "no short url in response"; exit 1; }
echo "==> redirect HEAD"
curl -fsSI "$short" | grep -qi '^location:' || { echo "missing redirect"; exit 1; }
echo "OK"