Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test UnregisteredClient invoking RPC and improve check IsRPCError #84

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions integ/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ ELASTICSEARCH_VERSION=7.16.2
MYSQL_VERSION=8
POSTGRESQL_VERSION=13
TEMPORAL_VERSION=1.25
TEMPORAL_ADMIN_TOOLS_VERSION=1.25.2-tctl-1.18.1-cli-1.1.1
TEMPORAL_UI_VERSION=2.31.2
2 changes: 1 addition & 1 deletion integ/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ services:
environment:
- TEMPORAL_ADDRESS=temporal:7233
- TEMPORAL_CLI_ADDRESS=temporal:7233
image: temporalio/admin-tools:${TEMPORAL_VERSION}
image: temporalio/admin-tools:${TEMPORAL_ADMIN_TOOLS_VERSION}
networks:
- temporal-network
stdin_open: true
Expand Down
5 changes: 5 additions & 0 deletions integ/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ func TestRPCWorkflow(t *testing.T) {
rpcErr, _ := err.(*iwf.ApiError)
assert.Equal(t, "worker API error, status:501, errorType:test-error-type", rpcErr.Response.GetDetail())

// Test unregister client
unregClient := iwf.NewUnregisteredClient(nil)
err = unregClient.InvokeRPCByName(context.Background(), wfId, "", "TestErrorRPC", 1, nil, nil)
assert.NotNil(t, err)

var rpcOutput int
err = client.InvokeRPC(context.Background(), wfId, "", wf.TestRPC, 1, &rpcOutput)
assert.Nil(t, err)
Expand Down
4 changes: 2 additions & 2 deletions integ/workflow_uncompleted_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func TestStateApiTimeoutWorkflow(t *testing.T) {

fmt.Println(err)

expectedMsg := "workflow is not completed successfully, closedStatus: FAILED, failedErrorType(applies if failed as closedStatus):STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE, error message:activity error (type: StateApiWaitUntil, scheduledEventID: 8, startedEventID: 9, identity: ): activity StartToClose timeout (type: StartToClose)"
assert.Equal(t, expectedMsg, err.Error())
expectedMsg := "workflow is not completed successfully, closedStatus: FAILED, failedErrorType(applies if failed as closedStatus):STATE_API_FAIL_MAX_OUT_RETRY_ERROR_TYPE, error message:activity error "
assert.True(t, strings.HasPrefix(err.Error(), expectedMsg))

out, err2 := client.GetComplexWorkflowResults(context.Background(), wfId, "")
assert.Nil(t, out)
Expand Down
2 changes: 1 addition & 1 deletion iwf/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func IsWorkflowNotExistsError(err error) bool {

func IsRPCError(err error) bool {
apiError, ok := err.(*ApiError)
if !ok || apiError.Response == nil {
ktrops marked this conversation as resolved.
Show resolved Hide resolved
if !ok {
return false
}
return apiError.StatusCode == 420
Expand Down
Loading