@@ -51,33 +51,51 @@ func (s *apiSuite) TeardownTest() {
5151func (s * apiSuite ) TestWorkflowCompleted () {
5252 s .mutableState .EXPECT ().IsWorkflowExecutionRunning ().Return (false )
5353
54- _ , err := isActivityTaskValid (s .workflowLease , rand .Int63 ())
54+ _ , err := isActivityTaskValid (s .workflowLease , rand .Int63 (), rand . Int31 () )
5555 s .Error (err )
5656 s .IsType (& serviceerror.NotFound {}, err )
5757}
5858
5959func (s * apiSuite ) TestWorkflowRunning_ActivityTaskNotStarted () {
6060 s .mutableState .EXPECT ().IsWorkflowExecutionRunning ().Return (true )
6161 activityScheduleEventID := rand .Int63 ()
62+ stamp := rand .Int31 ()
6263 s .mutableState .EXPECT ().GetActivityInfo (activityScheduleEventID ).Return (& persistencespb.ActivityInfo {
6364 ScheduledEventId : activityScheduleEventID ,
6465 StartedEventId : common .EmptyEventID ,
66+ Stamp : stamp ,
6567 }, true )
6668
67- valid , err := isActivityTaskValid (s .workflowLease , activityScheduleEventID )
69+ valid , err := isActivityTaskValid (s .workflowLease , activityScheduleEventID , stamp )
6870 s .NoError (err )
6971 s .True (valid )
7072}
7173
7274func (s * apiSuite ) TestWorkflowRunning_ActivityTaskStarted () {
7375 s .mutableState .EXPECT ().IsWorkflowExecutionRunning ().Return (true )
7476 activityScheduleEventID := rand .Int63 ()
77+ stamp := rand .Int31 ()
7578 s .mutableState .EXPECT ().GetActivityInfo (activityScheduleEventID ).Return (& persistencespb.ActivityInfo {
7679 ScheduledEventId : activityScheduleEventID ,
7780 StartedEventId : activityScheduleEventID + 1 ,
81+ Stamp : stamp ,
7882 }, true )
7983
80- valid , err := isActivityTaskValid (s .workflowLease , activityScheduleEventID )
84+ valid , err := isActivityTaskValid (s .workflowLease , activityScheduleEventID , stamp )
85+ s .NoError (err )
86+ s .False (valid )
87+ }
88+
89+ func (s * apiSuite ) TestWorkflowRunning_ActivityTaskStampMismatch () {
90+ s .mutableState .EXPECT ().IsWorkflowExecutionRunning ().Return (true )
91+ activityScheduleEventID := rand .Int63 ()
92+ s .mutableState .EXPECT ().GetActivityInfo (activityScheduleEventID ).Return (& persistencespb.ActivityInfo {
93+ ScheduledEventId : activityScheduleEventID ,
94+ StartedEventId : common .EmptyEventID ,
95+ Stamp : rand .Int31 (),
96+ }, true )
97+
98+ valid , err := isActivityTaskValid (s .workflowLease , activityScheduleEventID , rand .Int31 ())
8199 s .NoError (err )
82100 s .False (valid )
83101}
@@ -87,7 +105,7 @@ func (s *apiSuite) TestWorkflowRunning_ActivityTaskMissing() {
87105 activityScheduleEventID := rand .Int63 ()
88106 s .mutableState .EXPECT ().GetActivityInfo (activityScheduleEventID ).Return (nil , false )
89107
90- valid , err := isActivityTaskValid (s .workflowLease , activityScheduleEventID )
108+ valid , err := isActivityTaskValid (s .workflowLease , activityScheduleEventID , rand . Int31 () )
91109 s .NoError (err )
92110 s .False (valid )
93111}
0 commit comments