diff --git a/cmd/minikube/cmd/start.go b/cmd/minikube/cmd/start.go index de75058168ca..702ae3aceb1a 100644 --- a/cmd/minikube/cmd/start.go +++ b/cmd/minikube/cmd/start.go @@ -552,7 +552,7 @@ func selectDriver(oldConfig *cfg.Config) string { } if pick.Name == "" { - exit.WithCodeT(exit.Config, "Unable to determine a default driver to use. Try specifying --vm-driver, or visiting https://minikube.sigs.k8s.io/docs/start/") + exit.WithCodeT(exit.Config, "Unable to determine a default driver to use. Try specifying --vm-driver, or see https://minikube.sigs.k8s.io/docs/start/") } name = pick.Name diff --git a/hack/jenkins/windows_integration_test_hyperv.ps1 b/hack/jenkins/windows_integration_test_hyperv.ps1 index 4f3f9de0d10c..995b17506c52 100644 --- a/hack/jenkins/windows_integration_test_hyperv.ps1 +++ b/hack/jenkins/windows_integration_test_hyperv.ps1 @@ -19,7 +19,7 @@ gsutil.cmd -m cp -r gs://minikube-builds/$env:MINIKUBE_LOCATION/testdata . ./out/minikube-windows-amd64.exe delete -out/e2e-windows-amd64.exe -minikube-start-args="--vm-driver=hyperv --expected-default-driver=hyperv --hyperv-virtual-switch=primary-virtual-switch" -binary=out/minikube-windows-amd64.exe -test.v -test.timeout=65m +out/e2e-windows-amd64.exe --expected-default-driver=hyperv -minikube-start-args="--vm-driver=hyperv --hyperv-virtual-switch=primary-virtual-switch" -binary=out/minikube-windows-amd64.exe -test.v -test.timeout=65m $env:result=$lastexitcode # If the last exit code was 0->success, x>0->error If($env:result -eq 0){$env:status="success"} diff --git a/pkg/minikube/driver/install_test.go b/pkg/minikube/driver/install_test.go new file mode 100644 index 000000000000..f57e1f541e3b --- /dev/null +++ b/pkg/minikube/driver/install_test.go @@ -0,0 +1,45 @@ +/* +Copyright 2019 The Kubernetes Authors All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package driver + +import ( + "testing" +) + +func TestExtractVMDriverVersion(t *testing.T) { + v := extractVMDriverVersion("") + if len(v) != 0 { + t.Error("Expected empty string") + } + + v = extractVMDriverVersion("random text") + if len(v) != 0 { + t.Error("Expected empty string") + } + + expectedVersion := "1.2.3" + + v = extractVMDriverVersion("version: v1.2.3") + if expectedVersion != v { + t.Errorf("Expected version: %s, got: %s", expectedVersion, v) + } + + v = extractVMDriverVersion("version: 1.2.3") + if expectedVersion != v { + t.Errorf("Expected version: %s, got: %s", expectedVersion, v) + } +} diff --git a/pkg/minikube/registry/drvs/virtualbox/virtualbox.go b/pkg/minikube/registry/drvs/virtualbox/virtualbox.go index b50d8a777d6e..fa4483cf0b3c 100644 --- a/pkg/minikube/registry/drvs/virtualbox/virtualbox.go +++ b/pkg/minikube/registry/drvs/virtualbox/virtualbox.go @@ -23,7 +23,6 @@ import ( "github.com/docker/machine/drivers/virtualbox" "github.com/docker/machine/libmachine/drivers" - "github.com/pkg/errors" "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/driver" @@ -66,15 +65,26 @@ func configure(mc config.MachineConfig) interface{} { } func status() registry.State { - path, err := exec.LookPath("vboxmanage") + // Re-use this function as it's particularly helpful for Windows + tryPath := driver.VBoxManagePath() + path, err := exec.LookPath(tryPath) if err != nil { - return registry.State{Error: errors.Wrap(err, "vboxmanage path check"), Fix: "Install VirtualBox", Doc: docURL} + return registry.State{ + Error: fmt.Errorf("unable to find VBoxManage in $PATH"), + Fix: "Install VirtualBox", + Doc: docURL, + } } cmd := exec.Command(path, "list", "hostinfo") out, err := cmd.CombinedOutput() if err != nil { - return registry.State{Installed: true, Error: fmt.Errorf("%s failed:\n%s", strings.Join(cmd.Args, " "), out), Fix: "Install the latest version of VirtualBox", Doc: docURL} + return registry.State{ + Installed: true, + Error: fmt.Errorf("%s failed:\n%s", strings.Join(cmd.Args, " "), out), + Fix: "Install the latest version of VirtualBox", + Doc: docURL, + } } return registry.State{Installed: true, Healthy: true}