MCPcopy Index your code
hub / github.com/coder/coder / TestWorker_TickStoreError

Function TestWorker_TickStoreError

coderd/x/gitsync/worker_test.go:758–779  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

756}
757
758func TestWorker_TickStoreError(t *testing.T) {
759 t.Parallel()
760 ctx := testutil.Context(t, testutil.WaitShort)
761
762 tickDone := make(chan struct{})
763
764 ctrl := gomock.NewController(t)
765 store := dbmock.NewMockStore(ctrl)
766
767 store.EXPECT().AcquireStaleChatDiffStatuses(gomock.Any(), gomock.Any()).
768 DoAndReturn(func(context.Context, int32) ([]database.AcquireStaleChatDiffStatusesRow, error) {
769 close(tickDone)
770 return nil, fmt.Errorf("database unavailable")
771 })
772
773 mClock := quartz.NewMock(t)
774 logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
775 refresher := newTestRefresher(t, mClock)
776 worker := gitsync.NewWorker(store, refresher, nil, mClock, logger)
777
778 tickOnce(ctx, t, mClock, worker, tickDone)
779}
780
781func TestWorker_MarkStale_EmptyBranchOrOrigin(t *testing.T) {
782 t.Parallel()

Callers

nothing calls this directly

Calls 8

EXPECTMethod · 0.95
ContextFunction · 0.92
NewMockStoreFunction · 0.92
NewWorkerFunction · 0.92
newTestRefresherFunction · 0.85
tickOnceFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected