clienttest.go ×9

Frontier kind: Code frontier

unlabeled · c_7bdffcd91526

12 tests · 4036 LOC · 179 files · introduces 0 tests · 75 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges75 lines · 3 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
743 ranges4036 lines · 179 files · Browse complete extent
All tests (intent)
12 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

3 files ranked by introduced lines: 75 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/client/history/historytest/clienttest.go 69 introduced LOC · 9 ranges

Open complete file

36 }
37
38 > func (f fakeTracerProvider) Tracer(string, ...trace.TracerOption) trace.Tracer { clienttest.go
39 > return nil
40 > }
41
42 var _ trace.TracerProvider = (*fakeTracerProvider)(nil)
47 // 3. Create a client which connects to the server
48 // 4. Use the client to read the tasks
49 > func TestClient(t *testing.T, historyTaskQueueManager persistence.HistoryTaskQueueManager) { clienttest.go
50 > ctrl := gomock.NewController(t)
51 >
52 > listener := nettest.NewListener(nettest.NewPipe())
53 >
54 > serveErrs := make(chan error, 1)
55 > grpcServer := createServer(t, historyTaskQueueManager)
56 > go func() {
57 > serveErrs <- grpcServer.Serve(listener)
58 > }()
59
60 > client := createClient(ctrl, listener) clienttest.go
61 >
62 > t.Run("ReadDLQTasks", func(t *testing.T) {
63 t.Parallel()
64 queueKey := persistencetest.GetQueueKey(t, persistencetest.WithQueueType(persistence.QueueTypeHistoryDLQ))
71 readTasks(t, numTasks, client, queueKey.SourceCluster, queueKey.TargetCluster)
72 })
73 > t.Run("DeleteDLQTasks", func(t *testing.T) { clienttest.go
74 t.Parallel()
75 queueKey := persistencetest.GetQueueKey(t, persistencetest.WithQueueType(persistence.QueueTypeHistoryDLQ))
100 })
101
102 > t.Cleanup(func() { clienttest.go
103 > grpcServer.GracefulStop()
104 > assert.NoError(t, <-serveErrs)
105 > })
106 }
107
136 }
137
138 > func createServer(t *testing.T, historyTaskQueueManager persistence.HistoryTaskQueueManager) *grpc.Server { clienttest.go
139 > // TODO: find a better way to create a history handler
140 > historyHandler, err := historyserver.HandlerProvider(historyserver.NewHandlerArgs{
141 > TaskQueueManager: historyTaskQueueManager,
142 > TracerProvider: fakeTracerProvider{},
143 > TaskCategoryRegistry: tasks.NewDefaultTaskCategoryRegistry(),
144 > ChasmRegistry: chasm.NewRegistry(log.NewNoopLogger()),
145 > }, fxtest.NewLifecycle(t))
146 > if err != nil {
147 panic(err) // nolint:forbidigo // Panic is acceptable in test setup code.
148 }
149 > grpcServer := grpc.NewServer() clienttest.go
150 > historyservice.RegisterHistoryServiceServer(grpcServer, historyHandler)
151 > return grpcServer
152 }
153
154 > func createClient(ctrl *gomock.Controller, listener *nettest.PipeListener) historyservice.HistoryServiceClient { clienttest.go
155 > serviceResolver := membership.NewMockServiceResolver(ctrl)
156 > address := membership.NewHostInfoFromAddress("127.0.0.1:7104")
157 > serviceResolver.EXPECT().Members().Return([]membership.HostInfo{
158 > address,
159 > }).AnyTimes()
160 > serviceResolver.EXPECT().Lookup(gomock.Any()).Return(address, nil).AnyTimes()
161 > serviceResolver.EXPECT().AddListener(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
162 > serviceResolver.EXPECT().RemoveListener(gomock.Any()).Return(nil).AnyTimes()
163 > rpcFactory := nettest.NewRPCFactory(listener)
164 > client := history.NewClient(
165 > dynamicconfig.NewNoopCollection(),
166 > serviceResolver,
167 > log.NewTestLogger(),
168 > 1,
169 > rpcFactory,
170 > time.Second,
171 > )
172 > return client
173 > }
174
175 func enqueueTasks(
179 sourceCluster string,
180 targetCluster string,
181 > ) { clienttest.go
182 > t.Helper()
183 >
184 > task := &tasks.WorkflowTask{
185 > TaskID: 42,
186 > }
187 > for range numTasks {
188 > _, err := historyTaskQueueManager.EnqueueTask(context.Background(), &persistence.EnqueueTaskRequest{
189 > QueueType: persistence.QueueTypeHistoryDLQ,
190 > SourceCluster: sourceCluster,
191 > TargetCluster: targetCluster,
192 > Task: task,
193 > SourceShardID: 1,
194 > })
195 > require.NoError(t, err)
196 > }
197 }
go.temporal.io/server/common/persistence/tests/history_task_queue_manager_test_suite.go 3 introduced LOC · 1 range

Open complete file

go.temporal.io/server/service/history/handler.go 3 introduced LOC · 1 range

Open complete file

2053 ctx context.Context,
2054 request *historyservice.GetDLQTasksRequest,
2055 > ) (*historyservice.GetDLQTasksResponse, error) { handler.go
2056 > return getdlqtasks.Invoke(ctx, h.taskQueueManager, h.taskCategoryRegistry, request)
2057 > }
2058
2059 func (h *Handler) DeleteDLQTasks(