update unit test
parent
81aedea0bd
commit
518fd1d6fa
|
@ -29,6 +29,7 @@ import (
|
||||||
cfg "k8s.io/minikube/pkg/minikube/config"
|
cfg "k8s.io/minikube/pkg/minikube/config"
|
||||||
"k8s.io/minikube/pkg/minikube/constants"
|
"k8s.io/minikube/pkg/minikube/constants"
|
||||||
"k8s.io/minikube/pkg/minikube/cruntime"
|
"k8s.io/minikube/pkg/minikube/cruntime"
|
||||||
|
"k8s.io/minikube/pkg/minikube/detect"
|
||||||
"k8s.io/minikube/pkg/minikube/driver"
|
"k8s.io/minikube/pkg/minikube/driver"
|
||||||
"k8s.io/minikube/pkg/minikube/proxy"
|
"k8s.io/minikube/pkg/minikube/proxy"
|
||||||
)
|
)
|
||||||
|
@ -432,10 +433,11 @@ func TestValidateRuntime(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidatePorts(t *testing.T) {
|
func TestValidatePorts(t *testing.T) {
|
||||||
var tests = []struct {
|
type portTest struct {
|
||||||
ports []string
|
ports []string
|
||||||
errorMsg string
|
errorMsg string
|
||||||
}{
|
}
|
||||||
|
var tests = []portTest{
|
||||||
{
|
{
|
||||||
ports: []string{"test:80"},
|
ports: []string{"test:80"},
|
||||||
errorMsg: "Sorry, one of the ports provided with --ports flag is not valid [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"},
|
ports: []string{"0:80"},
|
||||||
errorMsg: "Sorry, one of the ports provided with --ports flag is outside range [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"},
|
ports: []string{"8080:80", "6443:443"},
|
||||||
errorMsg: "",
|
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 {
|
for _, test := range tests {
|
||||||
t.Run(strings.Join(test.ports, ","), func(t *testing.T) {
|
t.Run(strings.Join(test.ports, ","), func(t *testing.T) {
|
||||||
gotError := ""
|
gotError := ""
|
||||||
|
|
Loading…
Reference in New Issue