TestLoopbackHostPort should accept IPv6 loopback host

Kubernetes-commit: 8469b013333baec0dc2fc43a6bfb7493fcf019e8
This commit is contained in:
Aaron Crickenberger 2017-06-08 15:41:46 -07:00 committed by Kubernetes Publisher
parent 087d1a2efe
commit e110054277
1 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ limitations under the License.
package server package server
import ( import (
"strings" "net"
"testing" "testing"
) )
@ -37,8 +37,8 @@ func TestLoopbackHostPort(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
if !strings.HasPrefix(host, "127.") { if ip := net.ParseIP(host); ip == nil || !ip.IsLoopback() {
t.Fatalf("expected host to start with 127., got %q", host) t.Fatalf("expected host to be loopback, got %q", host)
} }
if port != "443" { if port != "443" {
t.Fatalf("expected 443 as port, got %q", port) t.Fatalf("expected 443 as port, got %q", port)