Skip to content

Commit fdf4282

Browse files
committed
fix: Use grpc.NewClient instead of grpc.Dial
1 parent b308e95 commit fdf4282

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

pkg/interceptors/database_logging_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ func TestDatabaseLoggingUnaryServerInterceptor(t *testing.T) {
7878
}
7979
}()
8080

81-
ctx := context.Background()
82-
conn, err := grpc.DialContext(ctx,
83-
"bufnet",
81+
conn, err := grpc.NewClient("passthrough://bufnet",
8482
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
8583
return lis.Dial()
8684
}),
@@ -152,9 +150,7 @@ func TestDatabaseLoggingStreamServerInterceptors(t *testing.T) {
152150
}
153151
}()
154152

155-
ctx := context.Background()
156-
conn, err := grpc.DialContext(ctx,
157-
"bufnet",
153+
conn, err := grpc.NewClient("passthrough://bufnet",
158154
grpc.WithTransportCredentials(insecure.NewCredentials()),
159155
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
160156
return lis.Dial()

pkg/interceptors/logger_test.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ func TestLoggerUnaryServerInterceptors(t *testing.T) {
5151
}
5252
}()
5353

54-
ctx := context.Background()
55-
conn, err := grpc.DialContext(ctx,
56-
"bufnet",
54+
conn, err := grpc.NewClient("passthrough://bufnet",
5755
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
5856
return lis.Dial()
5957
}),
@@ -100,9 +98,7 @@ func TestLoggerStreamServerInterceptors(t *testing.T) {
10098
}
10199
}()
102100

103-
ctx := context.Background()
104-
conn, err := grpc.DialContext(ctx,
105-
"bufnet",
101+
conn, err := grpc.NewClient("passthrough://bufnet",
106102
grpc.WithTransportCredentials(insecure.NewCredentials()),
107103
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
108104
return lis.Dial()

0 commit comments

Comments
 (0)