fix ipv6 addr parsing and using

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2019-07-17 10:38:50 +03:00
parent 995484282e
commit 640f0504b5

View File

@ -2,10 +2,7 @@ package grpc
import ( import (
"context" "context"
"fmt"
"net" "net"
"strconv"
"strings"
"testing" "testing"
"github.com/micro/go-micro/client" "github.com/micro/go-micro/client"
@ -37,10 +34,6 @@ func TestGRPCClient(t *testing.T) {
go s.Serve(l) go s.Serve(l)
defer s.Stop() defer s.Stop()
parts := strings.Split(l.Addr().String(), ":")
port, _ := strconv.Atoi(parts[len(parts)-1])
addr := strings.Join(parts[:len(parts)-1], ":")
// create mock registry // create mock registry
r := memory.NewRegistry() r := memory.NewRegistry()
@ -51,7 +44,7 @@ func TestGRPCClient(t *testing.T) {
Nodes: []*registry.Node{ Nodes: []*registry.Node{
&registry.Node{ &registry.Node{
Id: "test-1", Id: "test-1",
Address: fmt.Sprintf("%s:%d", addr, port), Address: l.Addr().String(),
}, },
}, },
}) })