Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] replace deprecated calls #10211

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pdata/plog/plogotlp/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
12 changes: 6 additions & 6 deletions pdata/pmetric/pmetricotlp/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
12 changes: 6 additions & 6 deletions pdata/ptrace/ptraceotlp/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/logs/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/metrics/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
2 changes: 1 addition & 1 deletion receiver/otlpreceiver/internal/trace/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
8 changes: 4 additions & 4 deletions receiver/otlpreceiver/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand All @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
Loading