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

Function TestInfer_GlobalDeadline504

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

Source from the content-addressed store, hash-verified

595}
596
597func TestInfer_GlobalDeadline504(t *testing.T) {
598 cfg := testConfig(10_000, false)
599 cfg.Server.RequestTimeoutMS = 80
600 srv := New(cfg)
601 srv.adapters["small-model"] = &blockingInferAdapter{
602 started: make(chan struct{}),
603 release: make(chan struct{}),
604 name: "small-model",
605 }
606 ts := httptest.NewServer(srv.Routes())
607 defer ts.Close()
608
609 status, body := postInfer(t, ts.URL, map[string]any{
610 "tenant_id": "team-a",
611 "task_type": "simple",
612 "input": map[string]any{"text": "hello"},
613 "options": map[string]any{"stream": false, "max_tokens": 128},
614 })
615 if status != http.StatusGatewayTimeout {
616 t.Fatalf("expected 504, got %d body=%s", status, string(body))
617 }
618 assertStructuredError(t, body, errCodeGatewayTimeout)
619}
620
621func TestInfer_ExecutionFailed502(t *testing.T) {
622 // mock adapter sleeps ~20ms; timeout 1ms forces deadline exceeded.

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected