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) diff --git a/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go b/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go index f264e470f28..937cf6ee2ab 100644 --- a/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go +++ b/instrumentation/google.golang.org/grpc/otelgrpc/test/interceptor_test.go @@ -69,7 +69,7 @@ func ctxDialer() func(context.Context, string) (net.Conn, error) { } func TestUnaryClientInterceptor(t *testing.T) { - clientConn, err := grpc.NewClient("fake:8906", + clientConn, err := grpc.NewClient("passthrough:fake", grpc.WithContextDialer(ctxDialer()), grpc.WithTransportCredentials(insecure.NewCredentials()), ) @@ -375,7 +375,7 @@ func newMockClientStream(opts clientStreamOpts) *mockClientStream { func createInterceptedStreamClient(t *testing.T, method string, opts clientStreamOpts) (grpc.ClientStream, *tracetest.SpanRecorder) { mockStream := newMockClientStream(opts) - clientConn, err := grpc.NewClient("fake:8906", + clientConn, err := grpc.NewClient("passthrough:fake", grpc.WithContextDialer(ctxDialer()), grpc.WithTransportCredentials(insecure.NewCredentials()), ) @@ -626,7 +626,7 @@ func TestStreamClientInterceptorOnUnidirectionalClientServerStream(t *testing.T) func TestStreamClientInterceptorCancelContext(t *testing.T) { defer goleak.VerifyNone(t) - clientConn, err := grpc.NewClient("fake:8906", + clientConn, err := grpc.NewClient("passthrough:fake", grpc.WithContextDialer(ctxDialer()), grpc.WithTransportCredentials(insecure.NewCredentials()), ) @@ -687,7 +687,7 @@ func TestStreamClientInterceptorCancelContext(t *testing.T) { func TestStreamClientInterceptorWithError(t *testing.T) { defer goleak.VerifyNone(t) - clientConn, err := grpc.NewClient("fake:8906", + clientConn, err := grpc.NewClient("passthrough:fake", grpc.WithContextDialer(ctxDialer()), grpc.WithTransportCredentials(insecure.NewCredentials()), )