MCPcopy Create free account
hub / github.com/InferCore/InferCore / TestRuleRouter_UsesRuleMatch

Function TestRuleRouter_UsesRuleMatch

internal/router/rule_router_test.go:45–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

43}
44
45func TestRuleRouter_UsesRuleMatch(t *testing.T) {
46 r := NewRuleRouter(testRouterConfig(), nil)
47 decision, err := r.SelectRoute(context.Background(), types.AIRequest{
48 TenantID: "team-a",
49 TaskType: "simple",
50 }, types.RuntimeState{})
51 if err != nil {
52 t.Fatalf("unexpected error: %v", err)
53 }
54 if decision.BackendName != "large-model" {
55 t.Fatalf("expected large-model, got %s", decision.BackendName)
56 }
57 if decision.Reason != "premium-simple-expensive-route" {
58 t.Fatalf("unexpected reason: %s", decision.Reason)
59 }
60}
61
62func TestRuleRouter_FallsBackToDefault(t *testing.T) {
63 r := NewRuleRouter(testRouterConfig(), nil)

Callers

nothing calls this directly

Calls 3

SelectRouteMethod · 0.95
NewRuleRouterFunction · 0.85
testRouterConfigFunction · 0.85

Tested by

no test coverage detected