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

Function TestWorker_MarkStale_EmptyBranchOrOrigin

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

Source from the content-addressed store, hash-verified

779}
780
781func TestWorker_MarkStale_EmptyBranchOrOrigin(t *testing.T) {
782 t.Parallel()
783
784 tests := []struct {
785 name string
786 branch string
787 origin string
788 }{
789 {"both empty", "", ""},
790 {"branch empty", "", "https://github.com/x/y"},
791 {"origin empty", "main", ""},
792 }
793
794 for _, tc := range tests {
795 t.Run(tc.name, func(t *testing.T) {
796 t.Parallel()
797 ctx := testutil.Context(t, testutil.WaitShort)
798
799 ctrl := gomock.NewController(t)
800 store := dbmock.NewMockStore(ctrl)
801
802 mClock := quartz.NewMock(t)
803 logger := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
804 refresher := newTestRefresher(t, mClock)
805 worker := gitsync.NewWorker(store, refresher, nil, mClock, logger)
806
807 worker.MarkStale(ctx, gitsync.MarkStaleParams{
808 WorkspaceID: uuid.New(),
809 Branch: tc.branch,
810 Origin: tc.origin,
811 })
812 })
813 }
814}
815
816func TestWorker_MarkStale_WithChatID(t *testing.T) {
817 t.Parallel()

Callers

nothing calls this directly

Calls 7

MarkStaleMethod · 0.95
ContextFunction · 0.92
NewMockStoreFunction · 0.92
NewWorkerFunction · 0.92
newTestRefresherFunction · 0.85
RunMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected