#!/usr/bin/env bash # Live M3 smoke test. Run from repo root: # bash scripts/m3_smoke.sh # # Walks through the scenarios in M3_VERIFICATION.md: # # Step 2 — warning to db-prod-04 → Alice only (Alice pre-linked, Bob not # yet linked, Carol unlinked + quiet hours). # Expected: 1 fcm (Alice) + 1 telegram (Alice). # Step 3 — critical to db-prod-04 → Alice + Bob (fcm). Bob is unlinked # so no telegram for him. # Step 4 — Bob runs /start acme-bob-002 via faketgmd admin queue. # Expect reply + telegram_user_id linked. # Step 5 — critical to db-prod-04 again. Bob is now linked. # Expected: 1 fcm (Alice) + 1 fcm (Bob) + 1 telegram (Alice) + # 1 telegram (Bob). # Step 6 — inminent_colapse to rack-b. Carol's quiet hours (00:00-23:59 # UTC) are bypassed. Bob is at min_severity=critical so he # passes. Expected: 1 fcm + 1 telegram for Alice, Bob, Carol # → 6 deliveries. # Step 7 — Bob /preferences. Confirm 1 subscription row, channel_mask # fcm+telegram, min=critical. # Step 8 — faketgmd /admin/sent should have 3 telegram messages # (one per Alice/Bob/Carol from step 6 plus 2 from step 5). # # Exit code is the number of failed checks. set -e cd "$(dirname "$0")/.." SECRET=s3cret-acme INGEST=http://localhost:8800/v1/ingest TELEGRAM_BOT_TOKEN=fake-tg-bot-token-acme-001 FAKETGMD=http://localhost:8830 PG="docker exec -i broad-announce-postgres-1 psql -U ba -d ba -A -t" send() { # send