MCPcopy Create free account
hub / github.com/coder/coder / newTestRunnerWithChatArchive

Function newTestRunnerWithChatArchive

scaletest/chat/run_internal_test.go:321–338  ·  view source on GitHub ↗
(t *testing.T, chatID uuid.UUID, updateErr error)

Source from the content-addressed store, hash-verified

319}
320
321func newTestRunnerWithChatArchive(t *testing.T, chatID uuid.UUID, updateErr error) (*Runner, func() bool) {
322 t.Helper()
323
324 var archived atomic.Bool
325 client := newFakeChatClient(t)
326 client.updateChatFunc = func(ctx context.Context, gotChatID uuid.UUID, req codersdk.UpdateChatRequest) error {
327 if gotChatID != chatID {
328 return xerrors.Errorf("unexpected chat archive ID: %s", gotChatID)
329 }
330 if req.Archived == nil || !*req.Archived {
331 return xerrors.Errorf("unexpected archived value: %v", req.Archived)
332 }
333 archived.Store(true)
334 return updateErr
335 }
336 runner := &Runner{client: client, cfg: Config{}, chatID: chatID}
337 return runner, archived.Load
338}
339
340func newTestRunnerWithChatMessage(t *testing.T, cfg Config, chatID uuid.UUID, onMessage func()) *Runner {
341 t.Helper()

Callers 1

TestRunnerCleanupFunction · 0.85

Calls 4

newFakeChatClientFunction · 0.85
HelperMethod · 0.65
ErrorfMethod · 0.45
StoreMethod · 0.45

Tested by

no test coverage detected