From dc6daeea1d1c86b1036d95606389bdeb01681908 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Wed, 25 Nov 2026 14:18:49 +0000 Subject: [PATCH] chore(plugin): exercise the decision block in catalog testData The auto router gets a shadow decision block and a provider with a decision path prefix. The manifest test mirrors both and runs New() on them. --- .traefik.yml | 14 ++++++++++++-- manifest_test.go | 10 ++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.traefik.yml b/.traefik.yml index 2f8c379..c0ab8c7 100644 --- a/.traefik.yml +++ b/.traefik.yml @@ -12,7 +12,7 @@ import: github.com/lukaszraczylo/traefik-llmgateway # integration suite). Required for both Traefik itself and the Plugin # Catalog analyzer (piceus), which uses this identical mechanism. basePkg: traefikllmgateway -summary: Multi-provider LLM gateway with groups, per-user keys, token/cost limits, MCP/A2A proxy. +summary: Multi-provider LLM gateway with groups, per-user keys, token/cost limits, smart routers, MCP/A2A proxy. testData: providers: openai: @@ -21,6 +21,13 @@ testData: models: - gpt-test - gpt-test-large + decider: + type: openai + apiKey: test-key + models: + - decider-test + pathBaseUrls: + /v1/decide: http://decider.example.invalid groups: default: providers: [] @@ -36,7 +43,7 @@ testData: # copy-pasted example here would risk skipping past. metrics: enabled: true - # Two-tier smart router with the v2 classifier, see README.md#smart-routers. + # Two-tier smart router with the v2 classifier and a shadow decision model, see README.md#smart-routers. smartRouters: auto: classifier: v2 @@ -47,3 +54,6 @@ testData: - name: large minScore: 400 models: [openai/gpt-test-large] + decision: + provider: decider + mode: shadow diff --git a/manifest_test.go b/manifest_test.go index 80ee52c..5cd153f 100644 --- a/manifest_test.go +++ b/manifest_test.go @@ -35,6 +35,8 @@ func testDataConfig(t *testing.T) *Config { "openai", "type: openai", "test-key", "gpt-test", "gpt-test-large", // providers.openai "auto", "classifier: v2", "name: small", "name: large", "minScore: 400", // smartRouters.auto "[openai/gpt-test]", "[openai/gpt-test-large]", // smartRouters.auto tier models + "decider", "decider-test", "pathBaseUrls", "/v1/decide: http://decider.example.invalid", // providers.decider + "decision:", "provider: decider", "mode: shadow", // smartRouters.auto.decision "default", // groups.default and users.inline[0].group "providers: []", // groups.default.providers — zero-semantic hedge, not bare {} "tester", // users.inline[0].name @@ -52,8 +54,9 @@ func testDataConfig(t *testing.T) *Config { cfg := CreateConfig() // mirror of testData, kept in sync by this test living next to the manifest - blob := `{"providers":{"openai":{"type":"openai","apiKey":"test-key","models":["gpt-test","gpt-test-large"]}}, - "smartRouters":{"auto":{"classifier":"v2","tiers":[ + blob := `{"providers":{"openai":{"type":"openai","apiKey":"test-key","models":["gpt-test","gpt-test-large"]}, + "decider":{"type":"openai","apiKey":"test-key","models":["decider-test"],"pathBaseUrls":{"/v1/decide":"http://decider.example.invalid"}}}, + "smartRouters":{"auto":{"classifier":"v2","decision":{"provider":"decider","mode":"shadow"},"tiers":[ {"name":"small","minScore":0,"models":["openai/gpt-test"]}, {"name":"large","minScore":400,"models":["openai/gpt-test-large"]}]}}, "groups":{"default":{"providers":[]}}, @@ -70,6 +73,9 @@ func TestNewFromTestData(t *testing.T) { if router := cfg.SmartRouters["auto"]; router == nil || len(router.Tiers) != 2 { t.Fatalf("testData must declare the two-tier smart router %q, got %+v", "auto", router) } + if d := cfg.SmartRouters["auto"].Decision; d == nil || d.Provider != "decider" { + t.Fatalf("testData must declare the decision block, got %+v", d) + } h, err := New(context.Background(), next, cfg, "llmgw") if err != nil { t.Fatalf("New: %v", err)