From 0687fea66aac9b8993a3b86c4a57b608bbf6eb96 Mon Sep 17 00:00:00 2001 From: bpopovschi Date: Mon, 14 Jan 2019 16:41:41 +0200 Subject: [PATCH] Added defaultDiskSize setup to hyperkit driver fmt fix --- pkg/drivers/hyperkit/driver.go | 2 ++ pkg/drivers/hyperkit/driver_test.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/pkg/drivers/hyperkit/driver.go b/pkg/drivers/hyperkit/driver.go index 442adc0ec6e6..f814c7cb2965 100644 --- a/pkg/drivers/hyperkit/driver.go +++ b/pkg/drivers/hyperkit/driver.go @@ -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), } } diff --git a/pkg/drivers/hyperkit/driver_test.go b/pkg/drivers/hyperkit/driver_test.go index 22d4ddbd39c0..3ee661ad78ff 100644 --- a/pkg/drivers/hyperkit/driver_test.go +++ b/pkg/drivers/hyperkit/driver_test.go @@ -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 {