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:
parent
aba3352793
commit
ec8e3844a9
2 changed files with 2 additions and 5 deletions
|
@ -37,7 +37,7 @@ func newProxy(addr string, tlsConfig *tls.Config) (*Proxy, error) {
|
||||||
p.dialOpts = append(p.dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package test
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/coredns/coredns/pb"
|
"github.com/coredns/coredns/pb"
|
||||||
|
|
||||||
|
@ -23,9 +22,7 @@ func TestGrpc(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer g.Stop()
|
defer g.Stop()
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
conn, err := grpc.NewClient(tcp, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
|
||||||
defer cancel()
|
|
||||||
conn, err := grpc.DialContext(ctx, tcp, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Expected no error but got: %s", err)
|
t.Fatalf("Expected no error but got: %s", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue