From 255855e30d7f9d17a8affe24c3e0aaecc7e0d714 Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy Date: Wed, 29 May 2024 10:25:34 +1000 Subject: [PATCH] Use passthrough resolver when bufnet is used --- .../google.golang.org/grpc/otelgrpc/benchmark_test.go | 2 +- .../google.golang.org/grpc/otelgrpc/test/grpc_test.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go index 4d9282397cb..544b28811c3 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/benchmark_test.go @@ -39,7 +39,7 @@ func benchmark(b *testing.B, cOpt []grpc.DialOption, sOpt []grpc.ServerOption) { ctx := context.Background() dial := func(context.Context, string) (net.Conn, error) { return l.Dial() } conn, err := grpc.NewClient( - "bufnet", + "passthrough:bufnet", append([]grpc.DialOption{ grpc.WithContextDialer(dial), grpc.WithTransportCredentials(insecure.NewCredentials()), diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go index 004b07085cf..991fad2efd6 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/grpc_test.go @@ -50,13 +50,16 @@ func newGrpcTest(t testing.TB, listener net.Listener, cOpt []grpc.DialOption, sO cOpt = append(cOpt, grpc.WithTransportCredentials(insecure.NewCredentials())) + dialAddr := listener.Addr().String() + if l, ok := listener.(interface{ Dial() (net.Conn, error) }); ok { dial := func(context.Context, string) (net.Conn, error) { return l.Dial() } cOpt = append(cOpt, grpc.WithContextDialer(dial)) + dialAddr = "passthrough:" + dialAddr } conn, err := grpc.NewClient( - listener.Addr().String(), + dialAddr, cOpt..., ) require.NoError(t, err)