package config import ( "os" "path/filepath" "strings" "testing" ) func TestLoadAcceptsUPSTargets(t *testing.T) { tmp := t.TempDir() cfgPath := filepath.Join(tmp, "hecate.yaml") raw := ` control_planes: [titan-0a, titan-0b, titan-0c] expected_flux_branch: main iac_repo_path: /opt/titan-iac ups: enabled: true provider: nut targets: - name: pyrphoros target: pyrphoros@localhost shutdown: default_budget_seconds: 300 state: run_history_path: /tmp/runs.json lock_path: /tmp/hecate.lock ` if err := os.WriteFile(cfgPath, []byte(strings.TrimSpace(raw)), 0o644); err != nil { t.Fatalf("write config: %v", err) } cfg, err := Load(cfgPath) if err != nil { t.Fatalf("load config: %v", err) } if len(cfg.UPS.Targets) != 1 || cfg.UPS.Targets[0].Target != "pyrphoros@localhost" { t.Fatalf("unexpected UPS targets: %#v", cfg.UPS.Targets) } } func TestValidateForwardShutdownRequiresConfigPath(t *testing.T) { cfg := defaults() cfg.Coordination.ForwardShutdownHost = "titan-db" cfg.Coordination.ForwardShutdownConfig = "" if err := cfg.Validate(); err == nil { t.Fatalf("expected validation error for missing forward_shutdown_config") } }