(t *testing.T)
| 619 | } |
| 620 | |
| 621 | func 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 | |
| 645 | func TestInfer_FallbackSkipsUnhealthyBackend(t *testing.T) { |
| 646 | cfg := testConfigTwoBackends(100, true) |
nothing calls this directly
no test coverage detected