Update grpc library use (#6826)

Replace deprecated grpc Dial/DialContext with grpc.NewClient.

Signed-off-by: SuperQ <superq@gmail.com>
This commit is contained in:
Ben Kochie 2024-08-18 06:13:10 +02:00 committed by GitHub
parent aba3352793
commit ec8e3844a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View file

@ -37,7 +37,7 @@ func newProxy(addr string, tlsConfig *tls.Config) (*Proxy, error) {
p.dialOpts = append(p.dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))
}
conn, err := grpc.Dial(p.addr, p.dialOpts...)
conn, err := grpc.NewClient(p.addr, p.dialOpts...)
if err != nil {
return nil, err
}

View file

@ -3,7 +3,6 @@ package test
import (
"context"
"testing"
"time"
"github.com/coredns/coredns/pb"
@ -23,9 +22,7 @@ func TestGrpc(t *testing.T) {
}
defer g.Stop()
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
conn, err := grpc.DialContext(ctx, tcp, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
conn, err := grpc.NewClient(tcp, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
if err != nil {
t.Fatalf("Expected no error but got: %s", err)
}