From d0113169970c558b09555dc6a3a54224444a1900 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sun, 7 Nov 2021 11:41:24 +0800 Subject: [PATCH] test: add more tests (#1209) --- zrpc/client_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/zrpc/client_test.go b/zrpc/client_test.go index 545ae124..795fe24f 100644 --- a/zrpc/client_test.go +++ b/zrpc/client_test.go @@ -82,6 +82,34 @@ func TestDepositServer_Deposit(t *testing.T) { return invoker(ctx, method, req, reply, cc, opts...) }), ) + nonBlockClient := MustNewClient( + RpcClientConf{ + Endpoints: []string{"foo"}, + App: "foo", + Token: "bar", + Timeout: 1000, + NonBlock: true, + }, + WithDialOption(grpc.WithContextDialer(dialer())), + WithUnaryClientInterceptor(func(ctx context.Context, method string, req, reply interface{}, + cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return invoker(ctx, method, req, reply, cc, opts...) + }), + ) + retryClient := MustNewClient( + RpcClientConf{ + Endpoints: []string{"foo"}, + App: "foo", + Token: "bar", + Timeout: 1000, + Retry: true, + }, + WithDialOption(grpc.WithContextDialer(dialer())), + WithUnaryClientInterceptor(func(ctx context.Context, method string, req, reply interface{}, + cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + return invoker(ctx, method, req, reply, cc, opts...) + }), + ) tarConfClient := MustNewClient( RpcClientConf{ Target: "foo", @@ -105,6 +133,8 @@ func TestDepositServer_Deposit(t *testing.T) { assert.Nil(t, err) clients := []Client{ directClient, + nonBlockClient, + retryClient, tarConfClient, targetClient, }