From 7b281c2661ada532ae7534b5f79f2c70c4812add Mon Sep 17 00:00:00 2001 From: David Porter Date: Mon, 27 Mar 2023 10:38:37 -0700 Subject: [PATCH] Adds a small test to catch issues with deadlocks (#5171) * Adds a small test to catch issues with deadlocks --- service/history/task/task_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/service/history/task/task_test.go b/service/history/task/task_test.go index 096956ee70a..c9385f16fed 100644 --- a/service/history/task/task_test.go +++ b/service/history/task/task_test.go @@ -25,6 +25,8 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -266,6 +268,18 @@ func (s *taskSuite) TestTaskNack_ResubmitFailed() { s.Equal(t.TaskStateNacked, task.State()) } +func (s *taskSuite) TestHandleErr_ErrMaxAttempts() { + taskBase := s.newTestTask(func(task Info) (bool, error) { + return true, nil + }, nil) + + taskBase.criticalRetryCount = func(i ...dynamicconfig.FilterOption) int { return 0 } + s.mockTaskInfo.EXPECT().GetTaskType().Return(0) + assert.NotPanics(s.T(), func() { + taskBase.HandleErr(errors.New("err")) + }) +} + func (s *taskSuite) newTestTask( taskFilter Filter, redispatchFn func(task Task),