Skip to content

Commit 654c49d

Browse files
Test UnregisteredClient invoking RPC and improve check IsRPCError (#84)
1 parent 22029b8 commit 654c49d

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

Diff for: integ/.env

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ ELASTICSEARCH_VERSION=7.16.2
33
MYSQL_VERSION=8
44
POSTGRESQL_VERSION=13
55
TEMPORAL_VERSION=1.25
6+
TEMPORAL_ADMIN_TOOLS_VERSION=1.25.2-tctl-1.18.1-cli-1.1.1
67
TEMPORAL_UI_VERSION=2.31.2

Diff for: integ/docker-compose.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ services:
5858
environment:
5959
- TEMPORAL_ADDRESS=temporal:7233
6060
- TEMPORAL_CLI_ADDRESS=temporal:7233
61-
image: temporalio/admin-tools:${TEMPORAL_VERSION}
61+
image: temporalio/admin-tools:${TEMPORAL_ADMIN_TOOLS_VERSION}
6262
networks:
6363
- temporal-network
6464
stdin_open: true

Diff for: integ/rpc_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ func TestRPCWorkflow(t *testing.T) {
3030
rpcErr, _ := err.(*iwf.ApiError)
3131
assert.Equal(t, "worker API error, status:501, errorType:test-error-type", rpcErr.Response.GetDetail())
3232

33+
// Test unregister client
34+
unregClient := iwf.NewUnregisteredClient(nil)
35+
err = unregClient.InvokeRPCByName(context.Background(), wfId, "", "TestErrorRPC", 1, nil, nil)
36+
assert.NotNil(t, err)
37+
3338
var rpcOutput int
3439
err = client.InvokeRPC(context.Background(), wfId, "", wf.TestRPC, 1, &rpcOutput)
3540
assert.Nil(t, err)

Diff for: integ/workflow_uncompleted_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ func TestStateApiTimeoutWorkflow(t *testing.T) {
112112

113113
fmt.Println(err)
114114

115-
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)"
116-
assert.Equal(t, expectedMsg, err.Error())
115+
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 "
116+
assert.True(t, strings.HasPrefix(err.Error(), expectedMsg))
117117

118118
out, err2 := client.GetComplexWorkflowResults(context.Background(), wfId, "")
119119
assert.Nil(t, out)

Diff for: iwf/errors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func IsWorkflowNotExistsError(err error) bool {
171171

172172
func IsRPCError(err error) bool {
173173
apiError, ok := err.(*ApiError)
174-
if !ok || apiError.Response == nil {
174+
if !ok {
175175
return false
176176
}
177177
return apiError.StatusCode == 420

0 commit comments

Comments
 (0)