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

Function TestInfer_PolicyRejected429

internal/server/server_test.go:470–491  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

468}
469
470func TestInfer_PolicyRejected429(t *testing.T) {
471 srv := New(testConfig(100, true))
472 ts := httptest.NewServer(srv.Routes())
473 defer ts.Close()
474
475 status, body := postInfer(t, ts.URL, map[string]any{
476 "tenant_id": "unknown-tenant",
477 "task_type": "simple",
478 "input": map[string]any{
479 "text": "hello",
480 },
481 "options": map[string]any{
482 "stream": false,
483 "max_tokens": 128,
484 },
485 })
486
487 if status != http.StatusTooManyRequests {
488 t.Fatalf("expected 429, got %d", status)
489 }
490 assertStructuredError(t, body, errCodePolicyRejected)
491}
492
493func TestInfer_InvalidInput400(t *testing.T) {
494 srv := New(testConfig(100, true))

Callers

nothing calls this directly

Calls 6

postInferFunction · 0.85
assertStructuredErrorFunction · 0.85
RoutesMethod · 0.80
NewFunction · 0.70
testConfigFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected