From 93f8f92bdd45e035d7710f4aede83374246c24a0 Mon Sep 17 00:00:00 2001 From: Alan Parra Date: Wed, 5 Jun 2024 16:52:07 -0300 Subject: [PATCH] fix: Do not DNS resolve on TestJoinServiceClient_RegisterUsingTPMMethod (#42513) --- api/client/joinservice_test.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/client/joinservice_test.go b/api/client/joinservice_test.go index dec8138ea57d0..a8a8509866d67 100644 --- a/api/client/joinservice_test.go +++ b/api/client/joinservice_test.go @@ -116,9 +116,14 @@ func TestJoinServiceClient_RegisterUsingTPMMethod(t *testing.T) { cancel() }() - c, err := grpc.NewClient("unused.com", grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) { - return lis.DialContext(ctx) - }), grpc.WithTransportCredentials(insecure.NewCredentials())) + // grpc.NewClient attempts to DNS resolve addr, whereas grpc.Dial doesn't. + c, err := grpc.Dial( + "bufconn", + grpc.WithContextDialer(func(ctx context.Context, _ string) (net.Conn, error) { + return lis.DialContext(ctx) + }), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) require.NoError(t, err) joinClient := NewJoinServiceClient(proto.NewJoinServiceClient(c))