diff --git a/pdata/plog/plogotlp/grpc_test.go b/pdata/plog/plogotlp/grpc_test.go index 9f8722fcefe..95ce393db0e 100644 --- a/pdata/plog/plogotlp/grpc_test.go +++ b/pdata/plog/plogotlp/grpc_test.go @@ -15,6 +15,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/resolver" "google.golang.org/grpc/status" "google.golang.org/grpc/test/bufconn" @@ -36,12 +37,12 @@ func TestGrpc(t *testing.T) { wg.Wait() }) - cc, err := grpc.Dial("bufnet", + resolver.SetDefaultScheme("passthrough") + cc, err := grpc.NewClient("bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return lis.Dial() }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) + grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, cc.Close()) @@ -69,12 +70,11 @@ func TestGrpcError(t *testing.T) { wg.Wait() }) - cc, err := grpc.Dial("bufnet", + cc, err := grpc.NewClient("bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return lis.Dial() }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) + grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, cc.Close()) diff --git a/pdata/pmetric/pmetricotlp/grpc_test.go b/pdata/pmetric/pmetricotlp/grpc_test.go index 074d4a5978f..e397f1d3e0c 100644 --- a/pdata/pmetric/pmetricotlp/grpc_test.go +++ b/pdata/pmetric/pmetricotlp/grpc_test.go @@ -15,6 +15,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/resolver" "google.golang.org/grpc/status" "google.golang.org/grpc/test/bufconn" @@ -36,12 +37,12 @@ func TestGrpc(t *testing.T) { wg.Wait() }) - cc, err := grpc.Dial("bufnet", + resolver.SetDefaultScheme("passthrough") + cc, err := grpc.NewClient("bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return lis.Dial() }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) + grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, cc.Close()) @@ -69,12 +70,11 @@ func TestGrpcError(t *testing.T) { wg.Wait() }) - cc, err := grpc.Dial("bufnet", + cc, err := grpc.NewClient("bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return lis.Dial() }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) + grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, cc.Close()) diff --git a/pdata/ptrace/ptraceotlp/grpc_test.go b/pdata/ptrace/ptraceotlp/grpc_test.go index e07044f8671..2fee7aa5a05 100644 --- a/pdata/ptrace/ptraceotlp/grpc_test.go +++ b/pdata/ptrace/ptraceotlp/grpc_test.go @@ -15,6 +15,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/resolver" "google.golang.org/grpc/status" "google.golang.org/grpc/test/bufconn" @@ -36,12 +37,12 @@ func TestGrpc(t *testing.T) { wg.Wait() }) - cc, err := grpc.Dial("bufnet", + resolver.SetDefaultScheme("passthrough") + cc, err := grpc.NewClient("bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return lis.Dial() }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) + grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, cc.Close()) @@ -69,12 +70,11 @@ func TestGrpcError(t *testing.T) { wg.Wait() }) - cc, err := grpc.Dial("bufnet", + cc, err := grpc.NewClient("bufnet", grpc.WithContextDialer(func(context.Context, string) (net.Conn, error) { return lis.Dial() }), - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithBlock()) + grpc.WithTransportCredentials(insecure.NewCredentials())) assert.NoError(t, err) t.Cleanup(func() { assert.NoError(t, cc.Close()) diff --git a/receiver/otlpreceiver/internal/logs/otlp_test.go b/receiver/otlpreceiver/internal/logs/otlp_test.go index cc87f527681..645be7e946e 100644 --- a/receiver/otlpreceiver/internal/logs/otlp_test.go +++ b/receiver/otlpreceiver/internal/logs/otlp_test.go @@ -74,7 +74,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) { func makeLogsServiceClient(t *testing.T, lc consumer.Logs) plogotlp.GRPCClient { addr := otlpReceiverOnGRPCServer(t, lc) - cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err, "Failed to create the TraceServiceClient: %v", err) t.Cleanup(func() { require.NoError(t, cc.Close()) diff --git a/receiver/otlpreceiver/internal/metrics/otlp_test.go b/receiver/otlpreceiver/internal/metrics/otlp_test.go index accd6102e27..3a87b34b724 100644 --- a/receiver/otlpreceiver/internal/metrics/otlp_test.go +++ b/receiver/otlpreceiver/internal/metrics/otlp_test.go @@ -75,7 +75,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) { func makeMetricsServiceClient(t *testing.T, mc consumer.Metrics) pmetricotlp.GRPCClient { addr := otlpReceiverOnGRPCServer(t, mc) - cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err, "Failed to create the MetricsServiceClient: %v", err) t.Cleanup(func() { require.NoError(t, cc.Close()) diff --git a/receiver/otlpreceiver/internal/trace/otlp_test.go b/receiver/otlpreceiver/internal/trace/otlp_test.go index f0dab89069d..ab538923729 100644 --- a/receiver/otlpreceiver/internal/trace/otlp_test.go +++ b/receiver/otlpreceiver/internal/trace/otlp_test.go @@ -71,7 +71,7 @@ func TestExport_PermanentErrorConsumer(t *testing.T) { func makeTraceServiceClient(t *testing.T, tc consumer.Traces) ptraceotlp.GRPCClient { addr := otlpReceiverOnGRPCServer(t, tc) - cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + cc, err := grpc.NewClient(addr.String(), grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err, "Failed to create the TraceServiceClient: %v", err) t.Cleanup(func() { require.NoError(t, cc.Close()) diff --git a/receiver/otlpreceiver/otlp_test.go b/receiver/otlpreceiver/otlp_test.go index 44501536298..51f99bb4cb8 100644 --- a/receiver/otlpreceiver/otlp_test.go +++ b/receiver/otlpreceiver/otlp_test.go @@ -566,7 +566,7 @@ func TestOTLPReceiverGRPCTracesIngestTest(t *testing.T) { require.NoError(t, recv.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, recv.Shutdown(context.Background())) }) - cc, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + cc, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) defer func() { assert.NoError(t, cc.Close()) @@ -722,7 +722,7 @@ func TestGRPCMaxRecvSize(t *testing.T) { recv := newReceiver(t, componenttest.NewNopTelemetrySettings(), cfg, otlpReceiverID, sink) require.NoError(t, recv.Start(context.Background(), componenttest.NewNopHost())) - cc, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + cc, err := grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) td := testdata.GenerateTraces(50000) @@ -735,7 +735,7 @@ func TestGRPCMaxRecvSize(t *testing.T) { require.NoError(t, recv.Start(context.Background(), componenttest.NewNopHost())) t.Cleanup(func() { require.NoError(t, recv.Shutdown(context.Background())) }) - cc, err = grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + cc, err = grpc.NewClient(addr, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) defer func() { assert.NoError(t, cc.Close()) @@ -1008,7 +1008,7 @@ func TestShutdown(t *testing.T) { require.NotNil(t, r) require.NoError(t, r.Start(context.Background(), componenttest.NewNopHost())) - conn, err := grpc.NewClient(endpointGrpc, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) + conn, err := grpc.NewClient(endpointGrpc, grpc.WithTransportCredentials(insecure.NewCredentials())) require.NoError(t, err) t.Cleanup(func() { require.NoError(t, conn.Close())