Compose runtime glossary files with native configuration

This commit is contained in:
2026-11-26 18:17:16 +00:00
parent b1cde637a2
commit a4b8fd0976
26 changed files with 292 additions and 92 deletions

View File

@@ -24,7 +24,7 @@ func TestMainContextImportsAndOverlay(t *testing.T) {
t.Fatal(err)
}
}
result, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, "selected", ck.Override{Path: ck.Keys("context", "description"), Value: "override", Flag: "--description"})
result, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, Options{Overlay: "selected", Overrides: []ck.Override{{Path: ck.Keys("context", "description"), Value: "override", Flag: "--description"}}})
if err != nil {
t.Fatal(err)
}
@@ -51,10 +51,10 @@ func TestMainContextImportsAndOverlay(t *testing.T) {
if !found {
t.Fatal("main source missing")
}
if _, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, "missing"); err == nil {
if _, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "main.yml"))}, Options{Overlay: "missing"}); err == nil {
t.Fatal("missing overlay accepted")
}
if _, _, err := Load(context.Background(), ck.Input{Source: ck.NoSource()}, "selected"); err == nil {
if _, _, err := Load(context.Background(), ck.Input{Source: ck.NoSource()}, Options{Overlay: "selected"}); err == nil {
t.Fatal("overlay without context accepted")
}
}
@@ -63,8 +63,11 @@ func TestDiscoveryAndSelectedFailure(t *testing.T) {
first, second := t.TempDir(), t.TempDir()
search := ck.Searches(ck.SearchDirectory(first), ck.SearchDirectory(second))
load := func() (*ck.Result[Config], error) {
result, _, err := Load(context.Background(), ck.Input{Source: ck.SearchConfig("audita", search)}, "")
return result, err
result, _, err := Load(context.Background(), ck.Input{Source: ck.SearchConfig("audita", search)}, Options{})
if err != nil {
return nil, err
}
return result.Result, nil
}
result, err := load()
if err != nil {
@@ -105,7 +108,7 @@ func TestOverlayUsesMainDirectoryWithinWiderRoot(t *testing.T) {
if err := os.WriteFile(filepath.Join(dir, "overlays", "local.yml"), []byte("context:\n description: project\n"), 0644); err != nil {
t.Fatal(err)
}
result, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml")), Filesystem: &ck.FilesystemContext{Root: root}}, "local")
result, _, err := Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml")), Filesystem: &ck.FilesystemContext{Root: root}}, Options{Overlay: "local"})
if err != nil {
t.Fatal(err)
}