Skip to content

Commit e5b6093

Browse files
committed
chore: Support taskExecutionId
Signed-off-by: Javier Aliaga <[email protected]>
1 parent f4ba09f commit e5b6093

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

workflow/activity_context.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ func (wfac *ActivityContext) Context() context.Context {
3636
return wfac.ctx.Context()
3737
}
3838

39+
func (wfac *ActivityContext) GetTaskExecutionID() string {
40+
return wfac.ctx.GetTaskExecutionID()
41+
}
42+
3943
type callActivityOption func(*callActivityOptions) error
4044

4145
type callActivityOptions struct {

workflow/activity_context_test.go

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,17 @@ import (
2828
)
2929

3030
type testingTaskActivityContext struct {
31-
inputBytes []byte
32-
ctx context.Context
31+
inputBytes []byte
32+
ctx context.Context
33+
taskExecutionID string
34+
}
35+
36+
func (t *testingTaskActivityContext) GetTaskID() int32 {
37+
return 0
38+
}
39+
40+
func (t *testingTaskActivityContext) GetTaskExecutionID() string {
41+
return t.taskExecutionID
3342
}
3443

3544
func (t *testingTaskActivityContext) GetInput(v any) error {
@@ -119,3 +128,19 @@ func TestMarshalData(t *testing.T) {
119128
assert.Equal(t, []byte{0x22, 0x74, 0x65, 0x73, 0x74, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22}, out)
120129
})
121130
}
131+
132+
func TestTaskExecutionID(t *testing.T) {
133+
ac := ActivityContext{ctx: &testingTaskActivityContext{ctx: t.Context(), taskExecutionID: "testTaskExecutionID"}}
134+
135+
t.Run("test getTaskExecutionID", func(t *testing.T) {
136+
assert.Equal(t, "testTaskExecutionID", ac.GetTaskExecutionID())
137+
})
138+
}
139+
140+
func TestTaskID(t *testing.T) {
141+
ac := ActivityContext{ctx: &testingTaskActivityContext{ctx: t.Context(), taskExecutionID: "testTaskExecutionID"}}
142+
143+
t.Run("test getTaskID", func(t *testing.T) {
144+
assert.EqualValues(t, 0, ac.ctx.GetTaskID())
145+
})
146+
}

0 commit comments

Comments
 (0)