Skip to content

Commit f0e4799

Browse files
committed
Test UnregisteredClient invoking RPC and improve check IsRPCError
1 parent 22029b8 commit f0e4799

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

integ/rpc_test.go

Lines changed: 5 additions & 0 deletions
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)

iwf/errors.go

Lines changed: 1 addition & 1 deletion
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)