Skip to content

Commit c06b7bb

Browse files
committed
add test for WithActivity
1 parent bc9f757 commit c06b7bb

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

internal/activity_test.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ func (s *activityTestSuite) TestGetWorkerStopChannel() {
235235
s.NotNil(channel)
236236
}
237237

238-
func (s *activityTestSuite) TestWithActivityTask() {
238+
// TestWithActivityTask_EmptyTask empty task should NEVER be passsed this stage. But still adding a test to avoid panics.
239+
func (s *activityTestSuite) TestWithActivityTask_EmptyTask() {
239240
ctx, cancel := context.WithCancel(context.Background())
240241
invoker := newServiceInvoker([]byte("task-token"), "identity", s.service, cancel, 5, make(chan struct{}), FeatureFlags{}, s.logger, testWorkflowType, testActivityType)
241242
ctx = context.WithValue(ctx, activityEnvContextKey, &activityEnvironment{serviceInvoker: invoker})
@@ -245,12 +246,5 @@ func (s *activityTestSuite) TestWithActivityTask() {
245246
newCtx := WithActivityTask(ctx, emptyTask, "task-list", invoker, s.logger, nil, nil, nil, nil, mocktracer.New())
246247

247248
// assertion
248-
activityEnv := newCtx.Value(activityEnvContextKey).(*activityEnvironment)
249-
s.Equal(testActivityType, activityEnv.activityType.Name)
250-
s.Equal(testWorkflowType, activityEnv.workflowType.Name)
251-
s.Equal("task-list", activityEnv.taskList)
252-
s.Equal(invoker, activityEnv.serviceInvoker)
253-
s.Equal(s.logger, activityEnv.logger)
254-
s.Equal(nil, activityEnv.metricsScope)
255-
s.Equal(nil, activityEnv.dataConverter)
249+
s.NotNil(newCtx)
256250
}

0 commit comments

Comments
 (0)