Skip to content

Commit

Permalink
Adds a small test to catch issues with deadlocks (uber#5171)
Browse files Browse the repository at this point in the history
* Adds a small test to catch issues with deadlocks
  • Loading branch information
davidporter-id-au authored Mar 27, 2023
1 parent f1e2476 commit 7b281c2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions service/history/task/task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 7b281c2

Please sign in to comment.