Merge pull request #3531 from Zyqsempai/add-default-disk-size-to-hyperkit-driver

Added defaultDiskSize setup to hyperkit driver
pull/3534/head
Thomas Strömberg 2019-01-15 16:41:10 -08:00 committed by GitHub
commit dde313a878
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -37,6 +37,7 @@ import (
hyperkit "github.com/moby/hyperkit/go"
"github.com/pkg/errors"
pkgdrivers "k8s.io/minikube/pkg/drivers"
"k8s.io/minikube/pkg/minikube/constants"
commonutil "k8s.io/minikube/pkg/util"
)
@ -70,6 +71,7 @@ func NewDriver(hostName, storePath string) *Driver {
SSHUser: "docker",
},
CommonDriver: &pkgdrivers.CommonDriver{},
DiskSize: commonutil.CalculateDiskSizeInMB(constants.DefaultDiskSize),
}
}

View File

@ -20,6 +20,10 @@ package hyperkit
import (
"testing"
"k8s.io/minikube/pkg/minikube/constants"
commonutil "k8s.io/minikube/pkg/util"
)
func Test_portExtraction(t *testing.T) {
@ -62,6 +66,15 @@ func Test_portExtraction(t *testing.T) {
}
}
func Test_defaultDiskSize(t *testing.T) {
expectedDefaultDiscSize := commonutil.CalculateDiskSizeInMB(constants.DefaultDiskSize)
driver := NewDriver("", "")
got := driver.DiskSize
if got != expectedDefaultDiscSize {
t.Errorf("Unexpected default disk size got: %v, want: %v", got, expectedDefaultDiscSize)
}
}
func testEq(a, b []int) bool {
if a == nil && b == nil {