Skip to content

Commit

Permalink
Added defaultDiskSize setup to hyperkit driver
Browse files Browse the repository at this point in the history
fmt fix
  • Loading branch information
Zyqsempai committed Jan 14, 2019
1 parent e6b60fb commit 0687fea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/drivers/hyperkit/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -70,6 +71,7 @@ func NewDriver(hostName, storePath string) *Driver {
SSHUser: "docker",
},
CommonDriver: &pkgdrivers.CommonDriver{},
DiskSize: commonutil.CalculateDiskSizeInMB(constants.DefaultDiskSize),
}
}

Expand Down
13 changes: 13 additions & 0 deletions pkg/drivers/hyperkit/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0687fea

Please sign in to comment.