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)
| 165 | // must not resurrect a duplicate `local` on next start. Same invariant as the |
| 166 | // deleted-hamrpass case, for the other managed profile. |
| 167 | func 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 |
| 174 | models: |
| 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 |
nothing calls this directly
no test coverage detected