fix zrpc client interceptor calling problem

This commit is contained in:
kevin
2020-10-20 17:57:41 +08:00
parent 907efd92c9
commit cee170f3e9
3 changed files with 24 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
package internal
import (
"context"
"testing"
"time"
@@ -23,6 +24,16 @@ func TestWithTimeout(t *testing.T) {
assert.Equal(t, time.Second, options.Timeout)
}
func TestWithUnaryClientInterceptor(t *testing.T) {
var options ClientOptions
opt := WithUnaryClientInterceptor(func(ctx context.Context, method string, req, reply interface{},
cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
return nil
})
opt(&options)
assert.Equal(t, 1, len(options.DialOptions))
}
func TestBuildDialOptions(t *testing.T) {
var c client
agent := grpc.WithUserAgent("chrome")