- Add streamd serve start|stop|restart|status|update with auto-written streamd.yaml - Panel modules: STREAMD_MODULES_DIR for describe, YAML channel fallback, textarea value fix - Per-stream WireGuard/SOCKS egress profiles + Settings UI - Drop drm-* from release builds; track streamd-bg.sh / streamd-update.sh wrappers - Docs: streamd-server-setup lifecycle and update flow
45 lines
1 KiB
Go
45 lines
1 KiB
Go
package api
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"streamd/apps/streamd/internal/modstore"
|
|
)
|
|
|
|
func TestChannelsFromStoreYAML(t *testing.T) {
|
|
root := t.TempDir()
|
|
store := modstore.New(root)
|
|
modDir := filepath.Join(root, "rte")
|
|
if err := os.MkdirAll(modDir, 0o755); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
yaml := []byte(`package: air.RTE
|
|
channels:
|
|
rteone:
|
|
label: RTE One
|
|
rtetwo:
|
|
label: RTE 2
|
|
`)
|
|
if err := os.WriteFile(filepath.Join(modDir, "module.yaml"), yaml, 0o644); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
chans := channelsFromStoreYAML(store, "rte")
|
|
if len(chans) != 2 {
|
|
t.Fatalf("got %d channels: %+v", len(chans), chans)
|
|
}
|
|
if chans[0].ID != "rteone" || chans[0].Label != "RTE One" {
|
|
t.Fatalf("first channel: %+v", chans[0])
|
|
}
|
|
if chans[1].ID != "rtetwo" {
|
|
t.Fatalf("second channel: %+v", chans[1])
|
|
}
|
|
}
|
|
|
|
func TestChannelsFromStoreYAMLMissing(t *testing.T) {
|
|
store := modstore.New(t.TempDir())
|
|
if chans := channelsFromStoreYAML(store, "nope"); chans != nil {
|
|
t.Fatalf("expected nil, got %+v", chans)
|
|
}
|
|
}
|