Adopt tagged diagnostic catalogs
This commit is contained in:
@@ -26,6 +26,16 @@ func Underlays() ([]configkit.Underlay, error) {
|
||||
return nil, err
|
||||
}
|
||||
catalogInputs := append(openrouterInputs, rakestrawhomeInputs...)
|
||||
openrouterSmokeTestInputs, err := assetInputs("OpenRouter smoke-test catalog", openrouter.FS(), openrouter.SmokeTestsRoot)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rakestrawhomeSmokeTestInputs, err := assetInputs("Rakestrawhome smoke-test catalog", rakestrawhome.FS(), rakestrawhome.SmokeTestsRoot)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
catalogInputs = append(catalogInputs, openrouterSmokeTestInputs...)
|
||||
catalogInputs = append(catalogInputs, rakestrawhomeSmokeTestInputs...)
|
||||
owned := configkit.Input{Source: configkit.Mapping("PromptKit-owned profiles", map[string]any{
|
||||
"profiles": map[string]any{
|
||||
"promptkit-openrouter-standard": map[string]any{"extends": "gemini-flash-latest"},
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"gitea.maximumdirect.net/eric/promptkit/internal/configuration"
|
||||
)
|
||||
|
||||
func TestPublishedCatalogsResolveThroughEffectiveConfiguration(t *testing.T) {
|
||||
func TestSelectedCatalogsResolveThroughEffectiveConfiguration(t *testing.T) {
|
||||
underlays, err := Underlays()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -22,10 +22,22 @@ func TestPublishedCatalogsResolveThroughEffectiveConfiguration(t *testing.T) {
|
||||
if err != nil || openrouter.Endpoint != "https://openrouter.ai/api/v1" || openrouter.ConcurrencyLimit != 16 || openrouter.QueueCapacity != 1024 {
|
||||
t.Fatalf("OpenRouter backend: %+v, %v", openrouter, err)
|
||||
}
|
||||
if openrouter.SmokeTests == nil || openrouter.SmokeTests.DefaultProfile == nil ||
|
||||
*openrouter.SmokeTests.DefaultProfile != "promptkit-openrouter-standard" ||
|
||||
openrouter.SmokeTests.Authentication == nil || openrouter.SmokeTests.Authentication.Kind == nil ||
|
||||
*openrouter.SmokeTests.Authentication.Kind != "openrouter_key" {
|
||||
t.Fatalf("OpenRouter smoke-test defaults: %+v", openrouter.SmokeTests)
|
||||
}
|
||||
rakestrawhome, err := state.GetBackend("rakestrawhome")
|
||||
if err != nil || rakestrawhome.Endpoint != "https://inference.ai.rakestrawhome.com/v1" || rakestrawhome.ConcurrencyLimit != 4 {
|
||||
t.Fatalf("Rakestrawhome backend: %+v, %v", rakestrawhome, err)
|
||||
}
|
||||
if rakestrawhome.SmokeTests == nil || rakestrawhome.SmokeTests.DefaultProfile == nil ||
|
||||
*rakestrawhome.SmokeTests.DefaultProfile != "rakestrawhome-gemma-4-31b" ||
|
||||
rakestrawhome.SmokeTests.Authentication == nil || rakestrawhome.SmokeTests.Authentication.Kind == nil ||
|
||||
*rakestrawhome.SmokeTests.Authentication.Kind != "none" {
|
||||
t.Fatalf("Rakestrawhome smoke-test defaults: %+v", rakestrawhome.SmokeTests)
|
||||
}
|
||||
for id, want := range map[string]string{
|
||||
"promptkit-openrouter-standard": "~google/gemini-flash-latest",
|
||||
"promptkit-openrouter-auto": "openrouter/auto",
|
||||
@@ -38,6 +50,42 @@ func TestPublishedCatalogsResolveThroughEffectiveConfiguration(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestConsumerCanReplaceOrClearSmokeTestDefaults(t *testing.T) {
|
||||
underlays, err := Underlays()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
replacement := configkit.Input{Source: configkit.Mapping("operator replacement", map[string]any{
|
||||
"backends": map[string]any{"openrouter": map[string]any{
|
||||
"smoke_tests": map[string]any{
|
||||
"default_profile": "operator-profile",
|
||||
"authentication": nil,
|
||||
},
|
||||
}},
|
||||
})}
|
||||
state, err := configuration.Load(replacement, underlays)
|
||||
if err != nil {
|
||||
t.Fatalf("load replacement: %v", err)
|
||||
}
|
||||
backend, err := state.GetBackend("openrouter")
|
||||
if err != nil || backend.SmokeTests == nil || backend.SmokeTests.DefaultProfile == nil ||
|
||||
*backend.SmokeTests.DefaultProfile != "operator-profile" || backend.SmokeTests.Authentication != nil {
|
||||
t.Fatalf("caller smoke-test replacement/null was not effective: %+v, %v", backend.SmokeTests, err)
|
||||
}
|
||||
|
||||
cleared := configkit.Input{Source: configkit.Mapping("operator null", map[string]any{
|
||||
"backends": map[string]any{"openrouter": map[string]any{"smoke_tests": nil}},
|
||||
})}
|
||||
state, err = configuration.Load(cleared, underlays)
|
||||
if err != nil {
|
||||
t.Fatalf("load null smoke_tests: %v", err)
|
||||
}
|
||||
backend, err = state.GetBackend("openrouter")
|
||||
if err != nil || backend.SmokeTests != nil {
|
||||
t.Fatalf("caller null did not clear smoke-test defaults: %+v, %v", backend.SmokeTests, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConsumerOverlayReplacesCatalogDefaultsBeforeValidation(t *testing.T) {
|
||||
underlays, err := Underlays()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user