From 518fd1d6fa78b51a773da371f13a4204a04e1132 Mon Sep 17 00:00:00 2001 From: Steven Powell Date: Mon, 15 Nov 2021 12:16:57 -0500 Subject: [PATCH] update unit test --- cmd/minikube/cmd/start_test.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/minikube/cmd/start_test.go b/cmd/minikube/cmd/start_test.go index fef084f0c8..1c78016640 100644 --- a/cmd/minikube/cmd/start_test.go +++ b/cmd/minikube/cmd/start_test.go @@ -29,6 +29,7 @@ import ( cfg "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/constants" "k8s.io/minikube/pkg/minikube/cruntime" + "k8s.io/minikube/pkg/minikube/detect" "k8s.io/minikube/pkg/minikube/driver" "k8s.io/minikube/pkg/minikube/proxy" ) @@ -432,10 +433,11 @@ func TestValidateRuntime(t *testing.T) { } func TestValidatePorts(t *testing.T) { - var tests = []struct { + type portTest struct { ports []string errorMsg string - }{ + } + var tests = []portTest{ { ports: []string{"test:80"}, errorMsg: "Sorry, one of the ports provided with --ports flag is not valid [test:80]", @@ -444,15 +446,17 @@ func TestValidatePorts(t *testing.T) { ports: []string{"0:80"}, errorMsg: "Sorry, one of the ports provided with --ports flag is outside range [0:80]", }, - { - ports: []string{"80:80"}, - errorMsg: "Sorry, you cannot use privileged ports on the host (below 1024) [80:80]", - }, { ports: []string{"8080:80", "6443:443"}, errorMsg: "", }, } + if detect.IsMicrosoftWSL() { + tests = append(tests, portTest{ + ports: []string{"80:80"}, + errorMsg: "Sorry, you cannot use privileged ports on the host (below 1024) [80:80]", + }) + } for _, test := range tests { t.Run(strings.Join(test.ports, ","), func(t *testing.T) { gotError := ""