#!/bin/bash # Gesamt-Funktionsprüfung — Smoke-Test für GWÖ-Antragsprüfer Live-System. # Usage: ./scripts/smoke-test.sh [base-url] # Default: https://gwoe.toppyr.de set -uo pipefail BASE="${1:-https://gwoe.toppyr.de}" PASS=0; FAIL=0; TOTAL=0 check() { local name="$1" expected="$2" url="$3" extra="${4:-}" TOTAL=$((TOTAL+1)) local code code=$(curl -s -o /dev/null -w "%{http_code}" $extra "$BASE$url" 2>&1 || echo "000") if [[ "$code" == "$expected" ]]; then printf " ✓ %-40s %s\n" "$name" "$code" PASS=$((PASS+1)) else printf " ✗ %-40s expected=%s got=%s\n" "$name" "$expected" "$code" FAIL=$((FAIL+1)) fi } contains() { local name="$1" pattern="$2" url="$3" TOTAL=$((TOTAL+1)) local body body=$(curl -s "$BASE$url" 2>&1) if echo "$body" | grep -qE "$pattern"; then printf " ✓ %-40s pattern=%s\n" "$name" "$pattern" PASS=$((PASS+1)) else printf " ✗ %-40s pattern=%s NOT FOUND\n" "$name" "$pattern" FAIL=$((FAIL+1)) fi } echo "================================================================" echo " GWÖ-Antragsprüfer Smoke-Test gegen $BASE" echo " $(date -Iseconds)" echo "================================================================" echo echo "[1] Hauptseiten erreichbar (alle 200)" check "v2 Default /" "200" "/" check "v2 Detail (echte DS)" "200" "/antrag/21/754S" check "Classic /classic" "200" "/classic" check "/auswertungen" "200" "/auswertungen" check "/methodik" "200" "/methodik" check "/quellen" "200" "/quellen" check "/impressum" "200" "/impressum" check "/datenschutz" "200" "/datenschutz" check "/v2/merkliste" "200" "/v2/merkliste" check "/v2/tags" "200" "/v2/tags" check "/v2/cluster" "200" "/v2/cluster" check "/v2/landtag-suche" "200" "/v2/landtag-suche" check "/v2/neu" "200" "/v2/neu" check "/v2/batch" "200" "/v2/batch" check "/health" "200" "/health" echo echo "[2] API-Endpoints (öffentlich)" check "/api/assessments" "200" "/api/assessments" check "/api/bundeslaender" "200" "/api/bundeslaender" check "/api/clusters" "200" "/api/clusters" check "/api/queue/status" "200" "/api/queue/status" check "/api/programme" "200" "/api/programme" check "/api/feed.xml" "200" "/api/feed.xml" check "/api/search?q=klima" "200" "/api/search?q=klima" check "/api/auswertungen/matrix" "200" "/api/auswertungen/matrix" check "/api/auswertungen/export.csv" "200" "/api/auswertungen/export.csv" check "/api/auth/me (unauth)" "200" "/api/auth/me" echo echo "[3] API-Endpoints (Auth-Schutz)" check "POST analyze-drucksache (no auth)" "401" "/api/analyze-drucksache" "-X POST -d ''" check "POST bookmark (no auth)" "401" "/api/bookmark" "-X POST" check "POST comment (no auth)" "401" "/api/comment" "-X POST" check "POST vote (no auth)" "401" "/api/vote" "-X POST" echo echo "[4] Statics (CSS, Fonts, Icons)" check "v2 tokens.css" "200" "/static/v2/tokens.css" check "v2 v2.css" "200" "/static/v2/v2.css" check "Nunito-Sans woff2" "200" "/static/v2/fonts/nunito-sans-latin-variable.woff2" check "Phosphor magnifying-glass" "200" "/static/v2/icons/phosphor/magnifying-glass.svg" echo echo "[5] Inhalts-Checks" contains "v2 rendert AppShell" 'v2-shell' "/" contains "v2 Sidebar vorhanden" 'v2-sidebar' "/" contains "v2 hat Login-Button" 'v2-auth-control' "/" contains "Detail rendert ScoreHero" 'big-num' "/antrag/21/754S" contains "Detail rendert MatrixMini" 'matrix-mini' "/antrag/21/754S" contains "Detail rendert Programm-Treue" 'Programm-Treue' "/antrag/21/754S" contains "Detail rendert Voting" 'castVote|v2DetailCastVote' "/antrag/21/754S" contains "Detail rendert Kommentare" 'v2-comments|loadComments' "/antrag/21/754S" contains "Detail OG-Meta-Tags" 'og:image' "/antrag/21/754S" contains "Cluster-API liefert JSON" 'clusters' "/api/clusters" contains "Auswertungen-Matrix JSON" 'bundeslaender' "/api/auswertungen/matrix" contains "Feed ist Atom" '