feat: runtime config, Matomo analytics, chat accounts, DM history/search, and Prometheus retention
This commit is contained in:
1 parent
06ab5b4655
commit
121fdbacdc
27 files changed
+1841
-161
No files matched your search
@@ -733,4 +733,48 @@ func TestHLSNextStartNumber(t *testing.T) {
|
||||
t.Errorf("seg-%06d should be kept: %v", i, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadSharedHLSConfig(t *testing.T) {
|
||||
prevDur := hlsSegmentDuration
|
||||
prevWin := hlsWindowSize
|
||||
defer func() {
|
||||
hlsSegmentDuration = prevDur
|
||||
hlsWindowSize = prevWin
|
||||
}()
|
||||
|
||||
tmpDir := t.TempDir()
|
||||
cfgPath := filepath.Join(tmpDir, "config.json")
|
||||
if err := os.WriteFile(cfgPath, []byte(`{"hls_segment_duration":"4","hls_window_size":"12"}`), 0o644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
os.Setenv("PLAYOUT_CONFIG_PATH", cfgPath)
|
||||
defer os.Unsetenv("PLAYOUT_CONFIG_PATH")
|
||||
|
||||
loadSharedHLSConfig()
|
||||
|
||||
if hlsSegmentDuration != "4" {
|
||||
t.Errorf("hlsSegmentDuration = %q, want 4", hlsSegmentDuration)
|
||||
}
|
||||
if hlsWindowSize != "12" {
|
||||
t.Errorf("hlsWindowSize = %q, want 12", hlsWindowSize)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadSharedHLSConfig_MissingFile(t *testing.T) {
|
||||
prevDur := hlsSegmentDuration
|
||||
prevWin := hlsWindowSize
|
||||
defer func() {
|
||||
hlsSegmentDuration = prevDur
|
||||
hlsWindowSize = prevWin
|
||||
}()
|
||||
|
||||
os.Setenv("PLAYOUT_CONFIG_PATH", filepath.Join(t.TempDir(), "nope.json"))
|
||||
defer os.Unsetenv("PLAYOUT_CONFIG_PATH")
|
||||
|
||||
loadSharedHLSConfig() // should be a no-op without erroring
|
||||
|
||||
if hlsSegmentDuration != prevDur {
|
||||
t.Errorf("hlsSegmentDuration changed to %q, want unchanged %q", hlsSegmentDuration, prevDur)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user