Skip to content

Commit

Permalink
Unit test fix for Go 1.19 (#877)
Browse files Browse the repository at this point in the history
Go 1.19 (correctly) notices that the following is basically useless as
it tests that an error can be converted to the error interface (which is
always the case).

```
err := NewWorkflowError(...)
target := errors.New("...")

errors.As(err, &target)
```

The broken test was further broken in that it expected the root cause Go
error to make it through the failure conversion machinery intact when in
truth the expectation is that it gets converted to an instance of
ApplicationError.
  • Loading branch information
Matt McShane committed Aug 5, 2022
1 parent 38b2b69 commit 0f9d428
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions internal/internal_workflow_testsuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2978,9 +2978,14 @@ func (s *WorkflowTestSuiteUnitTest) Test_ActivityRetry_NoRetries() {
s.True(env.IsWorkflowCompleted())
err := env.GetWorkflowError()
s.Error(err)

var workflowErr *WorkflowExecutionError
s.True(errors.As(err, &workflowErr))
s.True(errors.As(err, &fakeError))
s.ErrorAs(err, &workflowErr)

var appErr *ApplicationError
s.ErrorAs(err, &appErr)

s.ErrorContains(err, fakeError.Error())
}

func (s *WorkflowTestSuiteUnitTest) Test_ActivityHeartbeatRetry() {
Expand Down

0 comments on commit 0f9d428

Please sign in to comment.