diff --git a/hack/jenkins/common.sh b/hack/jenkins/common.sh index 5121ed2f7108..ad44c3a23921 100755 --- a/hack/jenkins/common.sh +++ b/hack/jenkins/common.sh @@ -165,7 +165,7 @@ if type -P vboxmanage; then vboxmanage unregistervm "${guid}" || true done - ifaces=$(vboxmanage list hostonlyifs | grep -E "^Name:" | awk '{ printf $2 }') + ifaces=$(vboxmanage list hostonlyifs | grep -E "^Name:" | awk '{ print $2 }') for if in $ifaces; do vboxmanage hostonlyif remove "${if}" || true done diff --git a/hack/jenkins/osx_integration_tests_virtualbox.sh b/hack/jenkins/osx_integration_tests_virtualbox.sh index b4382058c90f..8f7c6e3dd0b8 100755 --- a/hack/jenkins/osx_integration_tests_virtualbox.sh +++ b/hack/jenkins/osx_integration_tests_virtualbox.sh @@ -30,6 +30,8 @@ VM_DRIVER="virtualbox" JOB_NAME="VirtualBox_macOS" EXTRA_ARGS="--bootstrapper=kubeadm" PARALLEL_COUNT=3 +# hyperkit behaves better, so it has higher precedence. +# Assumes that hyperkit is also installed on the VirtualBox CI host. EXPECTED_DEFAULT_DRIVER="hyperkit" diff --git a/pkg/minikube/driver/driver.go b/pkg/minikube/driver/driver.go index 4222470a075d..a87d7a607120 100644 --- a/pkg/minikube/driver/driver.go +++ b/pkg/minikube/driver/driver.go @@ -111,6 +111,7 @@ func Choose(options []registry.DriverState) (registry.DriverState, []registry.Dr continue } if ds.Priority > pick.Priority { + glog.V(1).Infof("%q has a higher priority (%d) than %q (%d)", ds.Name, ds.Priority, pick.Name, pick.Priority) pick = ds } } diff --git a/pkg/minikube/registry/drvs/none/none.go b/pkg/minikube/registry/drvs/none/none.go index 3491b1909028..fa094f9aeaa8 100644 --- a/pkg/minikube/registry/drvs/none/none.go +++ b/pkg/minikube/registry/drvs/none/none.go @@ -1,3 +1,5 @@ +// +build linux + /* Copyright 2018 The Kubernetes Authors All rights reserved. diff --git a/pkg/minikube/registry/global.go b/pkg/minikube/registry/global.go index 0d95cd8da363..97882296a540 100644 --- a/pkg/minikube/registry/global.go +++ b/pkg/minikube/registry/global.go @@ -17,6 +17,8 @@ limitations under the License. package registry import ( + "os" + "github.com/golang/glog" ) @@ -54,12 +56,16 @@ func Driver(name string) DriverDef { // Installed returns a list of installed drivers in the global registry func Installed() []DriverState { sts := []DriverState{} + glog.Infof("Querying for installed drivers using PATH=%s", os.Getenv("PATH")) + for _, d := range globalRegistry.List() { if d.Status == nil { glog.Errorf("%q does not implement Status", d.Name) continue } s := d.Status() + glog.Infof("%s priority: %d, state: %+v", d.Name, d.Priority, s) + if !s.Installed { glog.Infof("%q not installed: %v", d.Name, s.Error) continue diff --git a/test/integration/a_serial_test.go b/test/integration/a_serial_test.go index 77f90fe56bc0..ae931662d707 100644 --- a/test/integration/a_serial_test.go +++ b/test/integration/a_serial_test.go @@ -40,6 +40,10 @@ func TestDownloadOnly(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute) defer Cleanup(t, profile, cancel) + // Stores the startup run result for later error messages + var rrr *RunResult + var err error + t.Run("group", func(t *testing.T) { versions := []string{ constants.OldestKubernetesVersion, @@ -51,7 +55,14 @@ func TestDownloadOnly(t *testing.T) { // Explicitly does not pass StartArgs() to test driver default // --force to avoid uid check args := []string{"start", "--download-only", "-p", profile, "--force", "--alsologtostderr", fmt.Sprintf("--kubernetes-version=%s", v)} - rrr, err := Run(t, exec.CommandContext(ctx, Target(), args...)) + + // Preserve the initial run-result for debugging + if rrr == nil { + rrr, err = Run(t, exec.CommandContext(ctx, Target(), args...)) + } else { + _, err = Run(t, exec.CommandContext(ctx, Target(), args...)) + } + if err != nil { t.Errorf("%s failed: %v", args, err) } @@ -74,34 +85,36 @@ func TestDownloadOnly(t *testing.T) { t.Errorf("expected the file for binary exist at %q but got error %v", fp, err) } } + }) + } - // Checking if the default driver meets expectations - if ExpectedDefaultDriver() == "" { - t.Logf("--expected-default-driver=%q, continuing", ExpectedDefaultDriver()) - return - } - rr, err := Run(t, exec.CommandContext(ctx, Target(), "profile", "list", "--output", "json")) - if err != nil { - t.Errorf("%s failed: %v", rr.Args, err) - } - var ps map[string][]config.Profile - err = json.Unmarshal(rr.Stdout.Bytes(), &ps) - if err != nil { - t.Errorf("%s failed: %v", rr.Args, err) - } + // Check that the profile we've created has the expected driver + t.Run("ExpectedDefaultDriver", func(t *testing.T) { + if ExpectedDefaultDriver() == "" { + t.Skipf("--expected-default-driver is unset, skipping test") + return + } + rr, err := Run(t, exec.CommandContext(ctx, Target(), "profile", "list", "--output", "json")) + if err != nil { + t.Errorf("%s failed: %v", rr.Args, err) + } + var ps map[string][]config.Profile + err = json.Unmarshal(rr.Stdout.Bytes(), &ps) + if err != nil { + t.Errorf("%s failed: %v", rr.Args, err) + } - got := "" - for _, p := range ps["valid"] { - if p.Name == profile { - got = p.Config.MachineConfig.VMDriver - } + got := "" + for _, p := range ps["valid"] { + if p.Name == profile { + got = p.Config.MachineConfig.VMDriver } + } - if got != ExpectedDefaultDriver() { - t.Errorf("got driver %q, expected %q\nstart output: %s", got, ExpectedDefaultDriver(), rrr.Output()) - } - }) - } + if got != ExpectedDefaultDriver() { + t.Errorf("got driver %q, expected %q\nstart output: %s", got, ExpectedDefaultDriver(), rrr.Output()) + } + }) // This is a weird place to test profile deletion, but this test is serial, and we have a profile to delete! t.Run("DeleteAll", func(t *testing.T) {