update unit test

pull/12952/head
Steven Powell 2021-11-15 12:16:57 -05:00
parent 81aedea0bd
commit 518fd1d6fa
1 changed files with 10 additions and 6 deletions

View File

@ -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 := ""