Files
linearvoid/scripts/test-playout-e2e.sh
zwitschi 5b5cdc4cd8
CI / test (push) Successful in 9m11s
CI / docker (push) Failing after 2m39s
CI / release (push) Skipped
Release / release (push) Canceled after 2m11s
chore: release v1.0.7
Playout: slate fallback, strict ffprobe validation, Prometheus metrics
Chat: history on join, DM offline delivery, env-config rate limits,
  Redis auto-reconnect, heartbeat, ban/mute enforcement, DM metrics
Viewer: presence indicators, schedule overlay, public /api/schedule
Admin: playlist drag-reorder, schedule overrides CRUD, user actions,
  inline mod buttons, CSV export, config editor, restart buttons,
  upload normalization gate, analytics time range
nginx: CORS preflight, JSON health, stub_status
Docs: test-lab vs production distinction across all configs/docs
Infra: Redis maxmemory, CD health IP-agnostic, slate volume mount
2026-08-06 17:41:52 +02:00

86 lines
2.4 KiB
Bash

#!/bin/bash
# End-to-end playout test: single file → 3-file playlist → verify seamless transition
# Requires: Docker, ffprobe, curl. Run from repo root.
set -e
echo "=== Playout End-to-End Test ==="
# 1. Build playout image
echo "[1/7] Building playout image..."
docker compose build playout
# 2. Create test playlist with 3 demo files (reuse demodata if exists)
TEST_PLAYLIST="data/playlist/playlist.txt"
mkdir -p data/playlist data/hls
echo "[2/7] Creating 3-file test playlist..."
cat > "$TEST_PLAYLIST" << 'EOF'
file '/app/media/demo1.mp4'
file '/app/media/demo2.mp4'
file '/app/media/demo1.mp4'
EOF
echo "Playlist created with 3 entries:"
cat "$TEST_PLAYLIST"
# 3. Validate playlist parses correctly
echo "[3/7] Validating playlist parse..."
LINE_COUNT=$(grep -c "^file " "$TEST_PLAYLIST" || true)
if [ "$LINE_COUNT" -ne 3 ]; then
echo "FAIL: Expected 3 entries, got $LINE_COUNT"
exit 1
fi
echo "OK: $LINE_COUNT entries parsed"
# 4. Start playout container
echo "[4/7] Starting playout container..."
docker compose up -d playout
sleep 8
# 5. Verify health endpoint
echo "[5/7] Checking playout health..."
HEALTH=$(curl -sf http://localhost:8081/health || echo "FAIL")
if echo "$HEALTH" | grep -q "healthy"; then
echo "OK: Health endpoint: $HEALTH"
else
echo "FAIL: Health check returned: $HEALTH"
docker compose logs playout --tail 30
exit 1
fi
# 6. Verify HLS output
echo "[6/7] Verifying HLS output..."
sleep 10 # Let FFmpeg produce some segments
if [ -f "data/hls/playlist.m3u8" ]; then
echo "OK: playlist.m3u8 exists"
MANIFEST_LINES=$(wc -l < data/hls/playlist.m3u8)
echo " Manifest lines: $MANIFEST_LINES"
else
echo "FAIL: No playlist.m3u8 generated"
docker compose logs playout --tail 30
exit 1
fi
SEGMENT_COUNT=$(find data/hls -name "segment_*.m4s" | wc -l)
if [ "$SEGMENT_COUNT" -ge 1 ]; then
echo "OK: $SEGMENT_COUNT segment(s) generated"
else
echo "FAIL: No segments generated"
exit 1
fi
# 7. Check for seamless transition markers (no FFmpeg errors in logs)
echo "[7/7] Checking for seamless transitions..."
ERRORS=$(docker compose logs playout 2>&1 | grep -ci "error" || true)
if [ "$ERRORS" -eq 0 ]; then
echo "OK: No FFmpeg errors in logs"
else
echo "WARN: $ERRORS error(s) in playout logs (may be R2 connection — check manually)"
fi
echo ""
echo "=== Playout E2E Test PASSED ==="
echo "Verified: playlist parse → HLS generation → health endpoint → segment output"
echo ""
echo "Cleanup: docker compose down playout"