Skip to content

Commit af32ca8

Browse files
authored
Merge pull request #182 from cschleiden/cschleiden/hanging-timer
Ensure tester panics when there are hanging timers
2 parents d3b1e9f + 007c2b1 commit af32ca8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tester/tester_timers_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,21 @@ func workflowTimer(ctx workflow.Context) (timerResult, error) {
4242
}, nil
4343
}
4444

45+
func Test_TimerHanging(t *testing.T) {
46+
wf := func(ctx workflow.Context) error {
47+
// Schedule timer and don't wait for it
48+
workflow.ScheduleTimer(ctx, 30*time.Second)
49+
50+
return nil
51+
}
52+
53+
tester := NewWorkflowTester[timerResult](wf)
54+
55+
require.Panics(t, func() {
56+
tester.Execute()
57+
})
58+
}
59+
4560
func Test_TimerCancellation(t *testing.T) {
4661
tester := NewWorkflowTester[time.Time](workflowTimerCancellation)
4762
start := tester.Now()

0 commit comments

Comments
 (0)