MCPcopy Create free account
hub / github.com/codehamr/codehamr / TestBootstrapDoesNotRestoreRenamedLocal

Function TestBootstrapDoesNotRestoreRenamedLocal

internal/config/config_test.go:167–197  ·  view source on GitHub ↗

TestBootstrapDoesNotRestoreRenamedLocal: renaming `local` (e.g. to `ollama`) must not resurrect a duplicate `local` on next start. Same invariant as the deleted-hamrpass case, for the other managed profile.

(t *testing.T)

Source from the content-addressed store, hash-verified

165// must not resurrect a duplicate `local` on next start. Same invariant as the
166// deleted-hamrpass case, for the other managed profile.
167func TestBootstrapDoesNotRestoreRenamedLocal(t *testing.T) {
168 dir := t.TempDir()
169 cdir := filepath.Join(dir, DirName)
170 if err := os.MkdirAll(cdir, 0o755); err != nil {
171 t.Fatal(err)
172 }
173 yaml := []byte(`active: ollama
174models:
175 ollama:
176 llm: local-model
177 url: http://localhost:11434
178 key: ""
179 context_size: 65536
180`)
181 if err := os.WriteFile(filepath.Join(cdir, "config.yaml"), yaml, 0o644); err != nil {
182 t.Fatal(err)
183 }
184 cfg, _, err := Bootstrap(dir)
185 if err != nil {
186 t.Fatal(err)
187 }
188 if _, ok := cfg.Models["local"]; ok {
189 t.Fatal("renamed-away `local` must not be restored")
190 }
191 if _, ok := cfg.Models["hamrpass"]; ok {
192 t.Fatal("hamrpass not declared in config.yaml; must not appear")
193 }
194 if len(cfg.Models) != 1 || cfg.Active != "ollama" {
195 t.Fatalf("expected single 'ollama' profile active, got Active=%q models=%+v", cfg.Active, cfg.Models)
196 }
197}
198
199// TestEnsureHamrpassLazyCreates: with hamrpass hidden from config.yaml,
200// EnsureHamrpass returns a profile from the canonical seed values, and is

Callers

nothing calls this directly

Calls 1

BootstrapFunction · 0.85

Tested by

no test coverage detected