Update public configuration and inventory contracts
This commit is contained in:
@@ -61,7 +61,7 @@ func TestProfileInheritanceConfiguredBaseAliasWorkflow(t *testing.T) {
|
||||
|
||||
func TestProfileInheritanceYAMLAliasOfConfiguredProfile(t *testing.T) {
|
||||
inputs, err := promptkit.FilesystemInputs("profile alias", fstest.MapFS{
|
||||
"config/alias.yaml": &fstest.MapFile{Data: []byte("profiles:\n base:\n model: synthetic-model\n yaml-alias:\n extends: base\n")},
|
||||
"config/alias.yaml": &fstest.MapFile{Data: []byte("profiles:\n - id: base\n model: synthetic-model\n - id: yaml-alias\n extends: {id: base}\n")},
|
||||
}, "config")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -79,12 +79,12 @@ func TestProfileInheritanceYAMLAliasOfConfiguredProfile(t *testing.T) {
|
||||
func TestProfileInheritanceRetainsRequiredCredentialBehavior(t *testing.T) {
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{
|
||||
Source: configkit.Mapping("credentials", map[string]any{
|
||||
"backends": map[string]any{"credential-backend": map[string]any{
|
||||
"backends": []any{map[string]any{"id": "credential-backend",
|
||||
"endpoint": "https://credential.example/v1", "api_key_env": "OPTIONAL_BACKEND_KEY",
|
||||
}},
|
||||
"profiles": map[string]any{
|
||||
"credential-base": map[string]any{"backend": "credential-backend", "model": "model", "api_key_required": true},
|
||||
"credential-child": map[string]any{"extends": "credential-base"},
|
||||
"profiles": []any{
|
||||
map[string]any{"id": "credential-base", "backend": "credential-backend", "model": "model", "api_key_required": true},
|
||||
map[string]any{"id": "credential-child", "extends": map[string]any{"id": "credential-base"}},
|
||||
},
|
||||
}),
|
||||
}}})
|
||||
@@ -106,8 +106,8 @@ func TestProfileInheritancePreservesPublicErrorIdentities(t *testing.T) {
|
||||
t.Fatalf("missing profile = (%+v, %v)", inspection, err)
|
||||
}
|
||||
for _, document := range []map[string]any{
|
||||
{"profiles": map[string]any{"child": map[string]any{"extends": "missing"}}},
|
||||
{"profiles": map[string]any{"a": map[string]any{"extends": "b"}, "b": map[string]any{"extends": "a"}}},
|
||||
{"profiles": []any{map[string]any{"id": "child", "extends": map[string]any{"id": "missing"}}}},
|
||||
{"profiles": []any{map[string]any{"id": "a", "extends": map[string]any{"id": "b"}}, map[string]any{"id": "b", "extends": map[string]any{"id": "a"}}}},
|
||||
} {
|
||||
invalid, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{
|
||||
Source: configkit.Mapping("invalid inheritance", document),
|
||||
@@ -120,7 +120,7 @@ func TestProfileInheritancePreservesPublicErrorIdentities(t *testing.T) {
|
||||
|
||||
func TestProfileInheritanceFreezesPreparedExecution(t *testing.T) {
|
||||
profiles := &mutableInheritanceProfileFS{files: fstest.MapFS{
|
||||
"config/profiles.yaml": &fstest.MapFile{Data: []byte("profiles:\n base:\n endpoint: https://base.example/v1\n model: first-model\n child:\n extends: base\n")},
|
||||
"config/profiles.yaml": &fstest.MapFile{Data: []byte("profiles:\n - id: base\n endpoint: https://base.example/v1\n model: first-model\n - id: child\n extends: {id: base}\n")},
|
||||
}}
|
||||
inputs, err := promptkit.FilesystemInputs("profiles", profiles, "config")
|
||||
if err != nil {
|
||||
@@ -138,7 +138,7 @@ func TestProfileInheritanceFreezesPreparedExecution(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
profiles.set("config/profiles.yaml", "profiles:\n base:\n endpoint: https://base.example/v1\n model: second-model\n child:\n extends: base\n")
|
||||
profiles.set("config/profiles.yaml", "profiles:\n - id: base\n endpoint: https://base.example/v1\n model: second-model\n - id: child\n extends: {id: base}\n")
|
||||
result, err := engine.RunPrepared(context.Background(), prepared)
|
||||
if err != nil || result == nil || client.model != "first-model" {
|
||||
t.Fatalf("prepared execution = (%+v, %v), model %q", result, err, client.model)
|
||||
|
||||
Reference in New Issue
Block a user