Document shared glossary inputs and migration
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -63,7 +64,11 @@ func TestMaintainedProjectsWithControlledProvider(t *testing.T) {
|
||||
t.Setenv("AUDITA_EXAMPLE_KEY", "")
|
||||
main = filepath.Join(dir, "config.yml")
|
||||
}
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, appconfig.Options{Overlay: tc.overlay})
|
||||
var glossaryFiles []string
|
||||
if tc.dir != "service" {
|
||||
glossaryFiles = []string{filepath.Join(root, tc.dir, "glossary.yml")}
|
||||
}
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, appconfig.Options{Overlay: tc.overlay, GlossaryFiles: glossaryFiles})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -159,7 +164,7 @@ func TestExamplePromptEditIsCapturedOnNextLoad(t *testing.T) {
|
||||
}
|
||||
}
|
||||
inspect := func() string {
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
|
||||
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{GlossaryFiles: []string{filepath.Join(dir, "glossary.yml")}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -258,3 +263,29 @@ func TestRuntimeGlossaryExampleWorkflow(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCampaignGlossaryArrangementsAgree(t *testing.T) {
|
||||
_, file, _, ok := runtime.Caller(0)
|
||||
if !ok {
|
||||
t.Fatal("cannot locate examples")
|
||||
}
|
||||
dir := filepath.Join(filepath.Dir(file), "..", "..", "examples", "campaigns")
|
||||
input := ck.Input{Source: ck.File(filepath.Join(dir, "first.yml"))}
|
||||
load := func(names ...string) *appconfig.Acquisition {
|
||||
t.Helper()
|
||||
var files []string
|
||||
for _, name := range names {
|
||||
files = append(files, filepath.Join(dir, name))
|
||||
}
|
||||
result, _, err := appconfig.Load(context.Background(), input, appconfig.Options{GlossaryFiles: files})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return result
|
||||
}
|
||||
combined := load("glossary.yml").Config.Application.GlossaryCollections
|
||||
separate := load("party.yml", "spells.yml").Config.Application.GlossaryCollections
|
||||
if !reflect.DeepEqual(combined, separate) {
|
||||
t.Fatalf("combined=%+v separate=%+v", combined, separate)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user