File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,11 @@ func (wt *workflowTester[TResult]) fireTimer() bool {
423
423
424
424
case TM_WallClock :
425
425
{
426
+ if wt .wallClockTimer != nil {
427
+ // Wall-clock timer already scheduled
428
+ return false
429
+ }
430
+
426
431
t := wt .timers [0 ]
427
432
428
433
wt .logger .Debug ("Scheduling wall-clock timer" , "at" , t .At )
Original file line number Diff line number Diff line change @@ -210,3 +210,35 @@ func Test_Timers_SetsTimeModeCorrectly(t *testing.T) {
210
210
require .Empty (t , werr )
211
211
tester .AssertExpectations (t )
212
212
}
213
+
214
+ func Test_Timers_MultipleTimers (t * testing.T ) {
215
+ activity1 := func () error {
216
+ return nil
217
+ }
218
+
219
+ wf := func (ctx workflow.Context ) error {
220
+ for i := 0 ; i < 10 ; i ++ {
221
+
222
+ tctx , cancel := workflow .WithCancel (ctx )
223
+ workflow .ScheduleTimer (tctx , time .Millisecond * 10 )
224
+ workflow .ExecuteActivity [string ](ctx , workflow .DefaultActivityOptions , activity1 ).Get (ctx )
225
+
226
+ cancel ()
227
+ }
228
+
229
+ return nil
230
+ }
231
+
232
+ dl := newDebugLogger ()
233
+
234
+ tester := NewWorkflowTester [string ](wf , WithTestTimeout (time .Second * 3 ), WithLogger (dl ))
235
+
236
+ tester .OnActivity (activity1 ).Return ("activity" , nil )
237
+
238
+ tester .Execute ()
239
+
240
+ require .True (t , tester .WorkflowFinished ())
241
+ _ , werr := tester .WorkflowResult ()
242
+ require .Empty (t , werr )
243
+ tester .AssertExpectations (t )
244
+ }
You can’t perform that action at this time.
0 commit comments