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

Function TestBootstrapCoercesUnknownActive

internal/config/config_test.go:480–509  ·  view source on GitHub ↗

TestBootstrapCoercesUnknownActive: an unknown `active:` is coerced to the first profile in sorted order so ActiveProfile never returns nil.

(t *testing.T)

Source from the content-addressed store, hash-verified

478// TestBootstrapCoercesUnknownActive: an unknown `active:` is coerced to the
479// first profile in sorted order so ActiveProfile never returns nil.
480func TestBootstrapCoercesUnknownActive(t *testing.T) {
481 dir := t.TempDir()
482 cdir := filepath.Join(dir, DirName)
483 if err := os.MkdirAll(cdir, 0o755); err != nil {
484 t.Fatal(err)
485 }
486 yaml := []byte(`active: ghost
487models:
488 zulu:
489 llm: m
490 url: http://z
491 key: ""
492 context_size: 1
493 alpha:
494 llm: m
495 url: http://a
496 key: ""
497 context_size: 1
498`)
499 if err := os.WriteFile(filepath.Join(cdir, "config.yaml"), yaml, 0o644); err != nil {
500 t.Fatal(err)
501 }
502 cfg, _, err := Bootstrap(dir)
503 if err != nil {
504 t.Fatal(err)
505 }
506 if cfg.Active != "alpha" {
507 t.Fatalf("unknown active should coerce to first sorted, got %q", cfg.Active)
508 }
509}
510
511// TestBootstrapRejectsEmptyModels: an empty `models:` block leaves Active
512// nothing to point at; Bootstrap must error readably (how to recover) rather

Callers

nothing calls this directly

Calls 1

BootstrapFunction · 0.85

Tested by

no test coverage detected