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

Function TestBootstrapRejectsEmptyModels

internal/config/config_test.go:514–531  ·  view source on GitHub ↗

TestBootstrapRejectsEmptyModels: an empty `models:` block leaves Active nothing to point at; Bootstrap must error readably (how to recover) rather than panic in the Active coercer.

(t *testing.T)

Source from the content-addressed store, hash-verified

512// nothing to point at; Bootstrap must error readably (how to recover) rather
513// than panic in the Active coercer.
514func TestBootstrapRejectsEmptyModels(t *testing.T) {
515 dir := t.TempDir()
516 cdir := filepath.Join(dir, DirName)
517 if err := os.MkdirAll(cdir, 0o755); err != nil {
518 t.Fatal(err)
519 }
520 yaml := []byte("active: none\nmodels: {}\n")
521 if err := os.WriteFile(filepath.Join(cdir, "config.yaml"), yaml, 0o644); err != nil {
522 t.Fatal(err)
523 }
524 _, _, err := Bootstrap(dir)
525 if err == nil {
526 t.Fatal("empty models map must be rejected, not silently coerced")
527 }
528 if !strings.Contains(err.Error(), "no profiles configured") {
529 t.Fatalf("error should explain the problem, got: %v", err)
530 }
531}
532
533// TestStrictYAMLRejectsUnknownKey: unknown top-level keys in config.yaml
534// must fail loud, not be silently ignored: surfaces typos immediately.

Callers

nothing calls this directly

Calls 2

BootstrapFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected