test: add E2E smoke test script + CI gate

After deploying the binary against a fresh data dir and exercising every
major REST endpoint by hand, codify the verification as a re-runnable
script.

scripts/smoke-test.sh:
  - Spins up bin/mediastation-go against a tempdir.
  - Generates 3 sample clips (movie, tv, anime) + an external SRT.
  - Walks 26 assertions: health → auth → libraries → scan → ffprobe →
    season parser → search → range stream → HLS playlist → external
    subtitle → history → favourites → playlists → RBAC (alice 403) →
    NFO export → recycle bin → SPA fallback → graceful shutdown.
  - Tears the server down via SIGTERM and reports pass/fail counts.
  - Exits non-zero on any failure so CI can use it as a deployment gate.

Local verification on this branch: PASS=26  FAIL=0.

Wiring:
  - Makefile: new 'smoke' target, depends on 'build'.
  - .github/workflows/ci.yml: third job 'smoke' that depends on backend
    + frontend, installs ffmpeg, builds both halves, then runs the
    script. The CI pipeline now blocks merges that break end-to-end
    deployability.
This commit is contained in:
Kiro
2026-05-14 16:36:34 +00:00
parent 8824638efb
commit 77e3fdd1f6
3 changed files with 274 additions and 1 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
.PHONY: all build build-server build-web dev dev-web run docker docker-stop clean install-web tidy test vet
.PHONY: all build build-server build-web dev dev-web run docker docker-stop clean install-web tidy test vet smoke
# ---- 默认目标 ----
all: build
@@ -46,5 +46,11 @@ test:
vet:
go vet ./...
# ---- 端到端冒烟测试 ----
# Spins up the binary against a temp dir, exercises every REST surface,
# tears it back down. Fails the build on any regression.
smoke: build
./scripts/smoke-test.sh
clean:
rm -rf bin/ web/dist/ web/node_modules/