(t *testing.T)
| 71 | } |
| 72 | |
| 73 | func TestBasicEngine_RateLimit(t *testing.T) { |
| 74 | engine := NewBasicEngine(testConfig()) |
| 75 | |
| 76 | first, _ := engine.Evaluate(context.Background(), types.AIRequest{ |
| 77 | TenantID: "team-a", |
| 78 | TaskType: "simple", |
| 79 | Options: types.RequestOptions{MaxTokens: 128}, |
| 80 | }) |
| 81 | second, _ := engine.Evaluate(context.Background(), types.AIRequest{ |
| 82 | TenantID: "team-a", |
| 83 | TaskType: "simple", |
| 84 | Options: types.RequestOptions{MaxTokens: 128}, |
| 85 | }) |
| 86 | |
| 87 | if !first.Allowed { |
| 88 | t.Fatalf("first request should pass") |
| 89 | } |
| 90 | if second.Allowed { |
| 91 | t.Fatalf("second request should be rate-limited") |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | func TestBasicEngine_BudgetExceeded(t *testing.T) { |
| 96 | engine := NewBasicEngine(testConfig()) |
nothing calls this directly
no test coverage detected