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

Function TestInfer_ExecutionFailed502

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

Source from the content-addressed store, hash-verified

619}
620
621func TestInfer_ExecutionFailed502(t *testing.T) {
622 // mock adapter sleeps ~20ms; timeout 1ms forces deadline exceeded.
623 srv := New(testConfig(1, false))
624 ts := httptest.NewServer(srv.Routes())
625 defer ts.Close()
626
627 status, body := postInfer(t, ts.URL, map[string]any{
628 "tenant_id": "team-a",
629 "task_type": "simple",
630 "input": map[string]any{
631 "text": "hello",
632 },
633 "options": map[string]any{
634 "stream": false,
635 "max_tokens": 128,
636 },
637 })
638
639 if status != http.StatusBadGateway {
640 t.Fatalf("expected 502, got %d", status)
641 }
642 assertStructuredError(t, body, errCodeExecutionFailed)
643}
644
645func TestInfer_FallbackSkipsUnhealthyBackend(t *testing.T) {
646 cfg := testConfigTwoBackends(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