Skip to content

Commit

Permalink
Test UnregisteredClient invoking RPC and improve check IsRPCError
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng committed Nov 8, 2024
1 parent 22029b8 commit f0e4799
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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
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 {
if !ok {
return false
}
return apiError.StatusCode == 420
Expand Down

0 comments on commit f0e4799

Please sign in to comment.