Change NewClientConn so that all options need to be specified by caller
This commit is contained in:
@ -192,9 +192,6 @@ func DoGenericStreamingRoundTrip(stream testpb.BenchmarkService_StreamingCallCli
|
|||||||
|
|
||||||
// NewClientConn creates a gRPC client connection to addr.
|
// NewClientConn creates a gRPC client connection to addr.
|
||||||
func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn {
|
func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn {
|
||||||
if len(opts) <= 0 {
|
|
||||||
opts = append(opts, grpc.WithInsecure())
|
|
||||||
}
|
|
||||||
conn, err := grpc.Dial(addr, opts...)
|
conn, err := grpc.Dial(addr, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
grpclog.Fatalf("NewClientConn(%q) failed to create a ClientConn %v", addr, err)
|
grpclog.Fatalf("NewClientConn(%q) failed to create a ClientConn %v", addr, err)
|
||||||
|
@ -18,7 +18,7 @@ func runUnary(b *testing.B, maxConcurrentCalls int) {
|
|||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
target, stopper := StartServer("localhost:0")
|
target, stopper := StartServer("localhost:0")
|
||||||
defer stopper()
|
defer stopper()
|
||||||
conn := NewClientConn(target)
|
conn := NewClientConn(target, grpc.WithInsecure())
|
||||||
tc := testpb.NewBenchmarkServiceClient(conn)
|
tc := testpb.NewBenchmarkServiceClient(conn)
|
||||||
|
|
||||||
// Warm up connection.
|
// Warm up connection.
|
||||||
@ -61,7 +61,7 @@ func runStream(b *testing.B, maxConcurrentCalls int) {
|
|||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
target, stopper := StartServer("localhost:0")
|
target, stopper := StartServer("localhost:0")
|
||||||
defer stopper()
|
defer stopper()
|
||||||
conn := NewClientConn(target)
|
conn := NewClientConn(target, grpc.WithInsecure())
|
||||||
tc := testpb.NewBenchmarkServiceClient(conn)
|
tc := testpb.NewBenchmarkServiceClient(conn)
|
||||||
|
|
||||||
// Warm up connection.
|
// Warm up connection.
|
||||||
|
Reference in New Issue
Block a user