package config import ( "os" "path/filepath" "testing" ) // TestDeployConfigLoads parses the file the box actually runs on. // // Every other test in this package builds its own JSON, so a key renamed in one // place and not the other would go unnoticed until the daemon refused to start. // This one reads deploy/mavend.json through the same Load the daemon calls, so // a config change and a code change have to agree here or the suite is red. // // The ${VAR} expansions come from a gitignored deploy/telegram.env that is not // present in CI. An unset var expands to the empty string, which is exactly the // "not configured" state every block already has to handle, so the parse is // still meaningful without the secrets. func TestDeployConfigLoads(t *testing.T) { path := filepath.Join("..", "..", "deploy", "mavend.json") if _, err := os.Stat(path); err != nil { t.Skipf("no deploy config at %s: %v", path, err) } cfg, err := Load(path) if err != nil { t.Fatalf("Load(%s): %v", path, err) } // Spot-check the settings whose absence would be a silent behaviour change // rather than a startup error. if cfg.Phraser == nil { t.Fatal("deploy config has no phraser block") } if cfg.Phraser.NGpuLayers == 0 { t.Error("phraser.n_gpu_layers is 0 — llama-server would run CPU-only, " + "because nothing in this package defaults that field") } if cfg.Voice == nil || !cfg.Voice.Enabled { t.Fatal("deploy config does not enable voice") } if !cfg.Voice.UseLLMRouter() { t.Error("deploy config turned the LLM router off") } if cfg.Voice.RouterThreshold <= 0 { t.Error("router threshold did not get its default") } }