seedChatDebugRun inserts a debug run for a chat, bypassing the chatd service so HTTP handlers can be exercised in isolation. Steps are inserted separately via seedChatDebugStep.
( ctx context.Context, t *testing.T, db database.Store, chatID uuid.UUID, startedAt time.Time, )
| 12468 | // service so HTTP handlers can be exercised in isolation. Steps are |
| 12469 | // inserted separately via seedChatDebugStep. |
| 12470 | func seedChatDebugRun( |
| 12471 | ctx context.Context, |
| 12472 | t *testing.T, |
| 12473 | db database.Store, |
| 12474 | chatID uuid.UUID, |
| 12475 | startedAt time.Time, |
| 12476 | ) database.ChatDebugRun { |
| 12477 | t.Helper() |
| 12478 | |
| 12479 | run, err := db.InsertChatDebugRun(dbauthz.AsSystemRestricted(ctx), database.InsertChatDebugRunParams{ |
| 12480 | ChatID: chatID, |
| 12481 | Kind: string(codersdk.ChatDebugRunKindChatTurn), |
| 12482 | Status: string(codersdk.ChatDebugStatusInProgress), |
| 12483 | Provider: sql.NullString{String: "openai", Valid: true}, |
| 12484 | Model: sql.NullString{String: "gpt-4o-mini", Valid: true}, |
| 12485 | StartedAt: sql.NullTime{Time: startedAt, Valid: true}, |
| 12486 | UpdatedAt: sql.NullTime{Time: startedAt, Valid: true}, |
| 12487 | }) |
| 12488 | require.NoError(t, err) |
| 12489 | return run |
| 12490 | } |
| 12491 | |
| 12492 | func seedChatDebugStep( |
| 12493 | ctx context.Context, |
no test coverage detected