MCPcopy Index your code
hub / github.com/InferCore/InferCore / TestInfer_RAG_EmptyQuery400

Function TestInfer_RAG_EmptyQuery400

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

Source from the content-addressed store, hash-verified

286}
287
288func TestInfer_RAG_EmptyQuery400(t *testing.T) {
289 cfg := testConfigWithFileKB(t)
290 srv := New(cfg)
291 ts := httptest.NewServer(srv.Routes())
292 defer ts.Close()
293
294 status, body := postInfer(t, ts.URL, map[string]any{
295 "request_type": "rag",
296 "tenant_id": "team-a",
297 "task_type": "simple",
298 "priority": "high",
299 "context": map[string]any{
300 "knowledge_base": "kb1",
301 },
302 "input": map[string]any{"text": ""},
303 "options": map[string]any{"stream": false, "max_tokens": 128},
304 })
305 if status != http.StatusBadRequest {
306 t.Fatalf("expected 400, got %d body=%s", status, string(body))
307 }
308 assertStructuredError(t, body, errCodeInvalidRequest)
309}
310
311func testConfigOpenAIEndpoint(t *testing.T, endpoint string) *config.Config {
312 t.Helper()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected