Make unit tests pass again
parent
680b542823
commit
443ae74719
|
@ -120,7 +120,6 @@ const (
|
|||
minimumCPUS = 2
|
||||
minimumDiskSize = "2000mb"
|
||||
autoUpdate = "auto-update-drivers"
|
||||
autoDetect = "auto-detect"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
1
go.mod
1
go.mod
|
@ -45,7 +45,6 @@ require (
|
|||
github.com/juju/version v0.0.0-20180108022336-b64dbd566305 // indirect
|
||||
github.com/libvirt/libvirt-go v3.4.0+incompatible
|
||||
github.com/machine-drivers/docker-machine-driver-vmware v0.1.1
|
||||
github.com/machine-drivers/machine v0.16.1 // indirect
|
||||
github.com/mattn/go-isatty v0.0.8
|
||||
github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936
|
||||
github.com/moby/hyperkit v0.0.0-20171020124204-a12cd7250bcd
|
||||
|
|
2
go.sum
2
go.sum
|
@ -314,8 +314,6 @@ github.com/machine-drivers/docker-machine-driver-vmware v0.1.1 h1:+E1IKKk+6kaQrC
|
|||
github.com/machine-drivers/docker-machine-driver-vmware v0.1.1/go.mod h1:ej014C83EmSnxJeJ8PtVb8OLJ91PJKO1Q8Y7sM5CK0o=
|
||||
github.com/machine-drivers/machine v0.7.1-0.20190910053320-21bd2f51b8ea h1:HVlxRL2rDz7hmchX5ZtvCArWmki1Z4pQg19FHrwQCgw=
|
||||
github.com/machine-drivers/machine v0.7.1-0.20190910053320-21bd2f51b8ea/go.mod h1:79Uwa2hGd5S39LDJt58s8JZcIhGEK6pkq9bsuTbFWbk=
|
||||
github.com/machine-drivers/machine v0.16.1 h1:q2QW23oQIo++kqoSF8Ll4G8yDVSjn0x0NditGayEwE4=
|
||||
github.com/machine-drivers/machine v0.16.1/go.mod h1:79Uwa2hGd5S39LDJt58s8JZcIhGEK6pkq9bsuTbFWbk=
|
||||
github.com/magiconair/properties v0.0.0-20160816085511-61b492c03cf4/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
|
||||
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
|
|
|
@ -22,8 +22,8 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
// Register drivers
|
||||
_ "k8s.io/minikube/pkg/minikube/registry/drvs"
|
||||
// Driver used by testdata
|
||||
_ "k8s.io/minikube/pkg/minikube/registry/drvs/virtualbox"
|
||||
|
||||
"github.com/docker/machine/libmachine/drivers"
|
||||
"github.com/docker/machine/libmachine/host"
|
||||
|
@ -53,12 +53,9 @@ func RegisterMockDriver(t *testing.T) {
|
|||
return
|
||||
}
|
||||
err = registry.Register(registry.DriverDef{
|
||||
Name: driver.Mock,
|
||||
Builtin: true,
|
||||
ConfigCreator: createMockDriverHost,
|
||||
DriverCreator: func() drivers.Driver {
|
||||
return &tests.MockDriver{T: t}
|
||||
},
|
||||
Name: driver.Mock,
|
||||
Config: createMockDriverHost,
|
||||
Init: func() drivers.Driver { return &tests.MockDriver{T: t} },
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("register failed: %v", err)
|
||||
|
|
|
@ -22,8 +22,6 @@ import (
|
|||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"k8s.io/minikube/pkg/minikube/driver"
|
||||
)
|
||||
|
||||
type configTestCase struct {
|
||||
|
@ -48,10 +46,10 @@ var configTestCases = []configTestCase{
|
|||
"log_dir": "/etc/hosts",
|
||||
"show-libmachine-logs": true,
|
||||
"v": 5,
|
||||
"vm-driver": "kvm2"
|
||||
"vm-driver": "test-driver"
|
||||
}`,
|
||||
config: map[string]interface{}{
|
||||
"vm-driver": driver.KVM2,
|
||||
"vm-driver": "test-driver",
|
||||
"cpus": 4,
|
||||
"disk-size": "20g",
|
||||
"v": 5,
|
||||
|
@ -132,7 +130,7 @@ func TestReadConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
expectedConfig := map[string]interface{}{
|
||||
"vm-driver": driver.KVM2,
|
||||
"vm-driver": "test-driver",
|
||||
"cpus": 4,
|
||||
"disk-size": "20g",
|
||||
"show-libmachine-logs": true,
|
||||
|
@ -151,7 +149,7 @@ func TestWriteConfig(t *testing.T) {
|
|||
}
|
||||
|
||||
cfg := map[string]interface{}{
|
||||
"vm-driver": driver.KVM2,
|
||||
"vm-driver": "test-driver",
|
||||
"cpus": 4,
|
||||
"disk-size": "20g",
|
||||
"show-libmachine-logs": true,
|
||||
|
|
|
@ -26,10 +26,10 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/config"
|
||||
)
|
||||
|
||||
// Priority is how we determine what driver to default to
|
||||
type Priority int
|
||||
|
||||
const (
|
||||
// Priority for default driver selection
|
||||
Unknown Priority = iota
|
||||
Discouraged
|
||||
Deprecated
|
||||
|
@ -69,7 +69,7 @@ type Configurator func(config.MachineConfig) interface{}
|
|||
// Loader is a function that loads a byte stream and creates a driver.
|
||||
type Loader func() drivers.Driver
|
||||
|
||||
// Status checks if a driver is available, offering a
|
||||
// StatusChecker checks if a driver is available, offering a
|
||||
type StatusChecker func() State
|
||||
|
||||
// State is the current state of the driver and its dependencies
|
||||
|
@ -81,7 +81,7 @@ type State struct {
|
|||
Doc string
|
||||
}
|
||||
|
||||
// State is metadata relating to a driver and status
|
||||
// DriverState is metadata relating to a driver and status
|
||||
type DriverState struct {
|
||||
Name string
|
||||
Priority Priority
|
||||
|
@ -200,5 +200,6 @@ func (r *driverRegistry) Driver(name string) (DriverDef, error) {
|
|||
return driver, nil
|
||||
}
|
||||
|
||||
glog.Errorf("driver %q not found in %v", name, r.drivers)
|
||||
return DriverDef{}, ErrDriverNotFound
|
||||
}
|
||||
|
|
|
@ -22,27 +22,10 @@ import (
|
|||
"k8s.io/minikube/pkg/minikube/config"
|
||||
)
|
||||
|
||||
func TestDriverString(t *testing.T) {
|
||||
bar := DriverDef{
|
||||
Name: "bar",
|
||||
Builtin: true,
|
||||
ConfigCreator: func(_ config.MachineConfig) interface{} {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
s := bar.String()
|
||||
if s != "{name: bar, builtin: true}" {
|
||||
t.Fatalf("Driver bar.String() returned unexpected: %v", s)
|
||||
}
|
||||
}
|
||||
|
||||
func testDriver(name string) DriverDef {
|
||||
return DriverDef{
|
||||
Name: name,
|
||||
Builtin: true,
|
||||
ConfigCreator: func(_ config.MachineConfig) interface{} {
|
||||
return nil
|
||||
},
|
||||
Name: name,
|
||||
Config: func(_ config.MachineConfig) interface{} { return nil },
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue