()
| 10 | ) |
| 11 | |
| 12 | func testRouterConfig() *config.Config { |
| 13 | return &config.Config{ |
| 14 | Backends: []config.BackendConfig{ |
| 15 | { |
| 16 | Name: "small-model", |
| 17 | Cost: config.CostConfig{Unit: 1}, |
| 18 | Capabilities: []string{"chat", "summarization"}, |
| 19 | }, |
| 20 | { |
| 21 | Name: "large-model", |
| 22 | Cost: config.CostConfig{Unit: 5}, |
| 23 | Capabilities: []string{"chat", "reasoning", "summarization"}, |
| 24 | }, |
| 25 | }, |
| 26 | Tenants: []config.TenantConfig{ |
| 27 | {ID: "team-a", Class: "premium", BudgetPerRequest: 10}, |
| 28 | }, |
| 29 | Routing: config.RoutingConfig{ |
| 30 | DefaultBackend: "small-model", |
| 31 | Rules: []config.RouteRule{ |
| 32 | { |
| 33 | Name: "premium-simple-expensive-route", |
| 34 | When: config.RouteWhen{ |
| 35 | TenantClass: "premium", |
| 36 | TaskType: "simple", |
| 37 | }, |
| 38 | UseBackend: "large-model", |
| 39 | }, |
| 40 | }, |
| 41 | }, |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | func TestRuleRouter_UsesRuleMatch(t *testing.T) { |
| 46 | r := NewRuleRouter(testRouterConfig(), nil) |
no outgoing calls
no test coverage detected