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

Function TestReplayCurrent_InferenceSuccess

internal/replay/replay_test.go:220–254  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

218}
219
220func TestReplayCurrent_InferenceSuccess(t *testing.T) {
221 cfg := replayTestConfig()
222 st := requests.NewMemoryStore()
223 req := types.AIRequest{
224 TenantID: "team-a",
225 TaskType: "chat",
226 Priority: "high",
227 Input: map[string]any{"text": "replay hi"},
228 Options: types.RequestOptions{Stream: false, MaxTokens: 64},
229 }
230 full, _ := json.Marshal(req)
231 _ = st.CreateRequest(context.Background(), requests.RequestRow{
232 RequestID: "rid3",
233 TenantID: req.TenantID,
234 TaskType: req.TaskType,
235 Priority: req.Priority,
236 AIRequestJSON: full,
237 CreatedAt: time.Now(),
238 UpdatedAt: time.Now(),
239 })
240 ad := mock.New(cfg.Backends[0])
241 deps := NewDependenciesFromConfig(cfg, map[string]interfaces.BackendAdapter{
242 "small-model": ad,
243 }, nil)
244 resp, err := Replay(context.Background(), cfg, st, "rid3", ModeCurrent, deps)
245 if err != nil {
246 t.Fatalf("replay: %v", err)
247 }
248 if resp.Status != "success" {
249 t.Fatalf("status=%q", resp.Status)
250 }
251 if resp.SelectedBackend != "small-model" {
252 t.Fatalf("backend=%q", resp.SelectedBackend)
253 }
254}

Callers

nothing calls this directly

Calls 6

NewMemoryStoreFunction · 0.92
NewFunction · 0.92
replayTestConfigFunction · 0.85
ReplayFunction · 0.85
CreateRequestMethod · 0.65

Tested by

no test coverage detected