test: add env override validation when config file is missing
This commit is contained in:
parent
34c68a7bff
commit
0e2580ea64
1 changed files with 16 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -13,6 +14,21 @@ func TestDefaultConfig_HeartbeatEnabled(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestLoadConfig_EnvOverridesWithoutFile ensures env vars are applied when the config file is missing.
|
||||||
|
func TestLoadConfig_EnvOverridesWithoutFile(t *testing.T) {
|
||||||
|
t.Setenv("PICOCLAW_AGENTS_DEFAULTS_MODEL", "env-model")
|
||||||
|
|
||||||
|
missing := filepath.Join(t.TempDir(), "missing.json")
|
||||||
|
cfg, err := LoadConfig(missing)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("expected no error, got %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if got := cfg.Agents.Defaults.Model; got != "env-model" {
|
||||||
|
t.Fatalf("expected model from env, got %q", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TestDefaultConfig_WorkspacePath verifies workspace path is correctly set
|
// TestDefaultConfig_WorkspacePath verifies workspace path is correctly set
|
||||||
func TestDefaultConfig_WorkspacePath(t *testing.T) {
|
func TestDefaultConfig_WorkspacePath(t *testing.T) {
|
||||||
cfg := DefaultConfig()
|
cfg := DefaultConfig()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue