-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check for cron workflow using temporal schedule (#426)
- Loading branch information
1 parent
997a5d4
commit ef706ab
Showing
6 changed files
with
831 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Unit Test | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
tests: | ||
name: "Unit testing" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: "Run unit tests" | ||
run: make unitTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package temporal | ||
|
||
import ( | ||
"errors" | ||
"github.com/golang/mock/gomock" | ||
"github.com/stretchr/testify/assert" | ||
"go.temporal.io/api/serviceerror" | ||
"testing" | ||
) | ||
|
||
func TestAlreadyStartedErrorForWorkflow(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
mockRealTemporalClient := NewMockClient(ctrl) | ||
mockDataConverter := NewMockDataConverter(ctrl) | ||
|
||
client := NewTemporalClient(mockRealTemporalClient, "test-ns", mockDataConverter, false) | ||
|
||
err := &serviceerror.WorkflowExecutionAlreadyStarted{} | ||
assert.Equal(t, true, client.IsWorkflowAlreadyStartedError(err)) | ||
} | ||
|
||
func TestAlreadyStartedErrorForCronWorkflow(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
mockRealTemporalClient := NewMockClient(ctrl) | ||
mockDataConverter := NewMockDataConverter(ctrl) | ||
|
||
client := NewTemporalClient(mockRealTemporalClient, "test-ns", mockDataConverter, false) | ||
|
||
err := errors.New("schedule with this ID is already registered") | ||
|
||
assert.Equal(t, true, client.IsWorkflowAlreadyStartedError(err)) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.