Null-DRM-Official/apps/modules/all/all_test.go
404errordeveloper da8e1123ec
All checks were successful
release / build-and-upload (push) Successful in 7m5s
Streamd v0.2.0: rename, modules panel, stable/beta channels
- Rename product/host binary to streamd (drm compat copy still shipped)
- Go module path streamd; STREAMD_* env aliases; agent UA streamd-agent
- Panel Modules store + agent pull sync (modstore / modsync)
- Rolling stable + beta download tags; README/docs channel curl blocks
- Release notes in docs/releases/v0.2.0.md attached by Forgejo Actions
2026-10-10 15:58:26 +02:00

78 lines
2 KiB
Go

package all
import (
"flag"
"testing"
appreg "streamd/app"
)
// Every module must be constructible with no module.yaml present — a fresh clone
// has none, and the binary still has to start and list its providers.
func TestAllModulesRegisterAndConstruct(t *testing.T) {
names := appreg.Names()
if len(names) == 0 {
t.Fatal("no app modules registered — check the blank imports in all.go")
}
for _, n := range names {
a, err := appreg.Get(n)
if err != nil {
t.Fatalf("construct %s: %v", n, err)
}
if a.Name() != n {
t.Errorf("%s: Name() = %q", n, a.Name())
}
switch a.KeyMode() {
case "raw", "modulardrm", "wrap", "none":
default:
t.Errorf("%s: KeyMode() = %q, want raw, modulardrm, wrap, or none", n, a.KeyMode())
}
if a.CAHash() == "" {
t.Errorf("%s: CAHash() empty", n)
}
if a.ProxyBin() == "" {
t.Errorf("%s: ProxyBin() empty", n)
}
if a.MPDRewriter() == nil {
t.Errorf("%s: MPDRewriter() nil", n)
}
if a.CaptureHints().RemoteLog == "" {
t.Errorf("%s: CaptureHints has no remote log", n)
}
if n == "c4" {
rw, ok := a.(appreg.RequireWVD)
if !ok || !rw.RequireWVD() {
t.Errorf("c4 must RequireWVD() so capture refuses MPD-only runs")
}
}
}
}
// Flag binding must not construct any app, so overrides land before config load.
func TestBindFlagsRegistersOverrides(t *testing.T) {
fs := flag.NewFlagSet("test", flag.ContinueOnError)
appreg.BindFlags(fs)
count := 0
fs.VisitAll(func(*flag.Flag) { count++ })
if count == 0 {
t.Fatal("no module override flags registered")
}
}
// A module declaring a rewriter must have registered it under that name.
func TestDeclaredRewritersAreRegistered(t *testing.T) {
for _, a := range appreg.All() {
sd, ok := a.(appreg.StreamDefaults)
if !ok {
continue
}
name := sd.RewriterName()
if name == "" || name == "none" {
continue
}
if a.MPDRewriter().Name() != name {
t.Errorf("%s: RewriterName()=%q but MPDRewriter().Name()=%q",
a.Name(), name, a.MPDRewriter().Name())
}
}
}