Skip to content

Commit

Permalink
Merge branch 'drv-select2' of github.com:tstromberg/minikube into drv…
Browse files Browse the repository at this point in the history
…-select2
  • Loading branch information
tstromberg committed Oct 25, 2019
2 parents 04acb59 + c50a849 commit d3618fb
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 26 deletions.
2 changes: 1 addition & 1 deletion hack/jenkins/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions hack/jenkins/osx_integration_tests_virtualbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
1 change: 1 addition & 0 deletions pkg/minikube/driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/minikube/registry/drvs/none/none.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build linux

/*
Copyright 2018 The Kubernetes Authors All rights reserved.
Expand Down
6 changes: 6 additions & 0 deletions pkg/minikube/registry/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package registry

import (
"os"

"github.com/golang/glog"
)

Expand Down Expand Up @@ -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
Expand Down
63 changes: 38 additions & 25 deletions test/integration/a_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
}
Expand All @@ -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) {
Expand Down

0 comments on commit d3618fb

Please sign in to comment.