Skip to content

Commit f6115d7

Browse files
dlorencdlorenc
dlorenc
authored andcommitted
Code review feedback.
1 parent de31909 commit f6115d7

File tree

6 files changed

+22
-7
lines changed

6 files changed

+22
-7
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ LOCALKUBE_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w -extldfla
5151

5252
LOCALKUBEFILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/localkube/ | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
5353
MINIKUBEFILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/minikube/ | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
54+
HYPERKIT_FILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' k8s.io/minikube/cmd/drivers/hyperkit | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
5455

5556
MINIKUBE_ENV_linux := CGO_ENABLED=1 GOARCH=amd64 GOOS=linux
5657
MINIKUBE_ENV_darwin := CGO_ENABLED=1 GOARCH=amd64 GOOS=darwin
@@ -213,7 +214,7 @@ out/minikube-installer.exe: out/minikube-windows-amd64.exe
213214
mv out/windows_tmp/minikube-installer.exe out/minikube-installer.exe
214215
rm -rf out/windows_tmp
215216

216-
out/docker-machine-driver-hyperkit:
217+
out/docker-machine-driver-hyperkit: $(shell $(HYPERKIT_FILES))
217218
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
218219
$(MINIKUBE_DOCKER_CMD) '$(MINIKUBE_ENV_darwin_DOCKER) $(MINIKUBE_ENV_darwin) go build -o $(BUILD_DIR)/docker-machine-driver-hyperkit k8s.io/minikube/cmd/drivers/hyperkit'
219220
else

hack/jenkins/common.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/pvc.yaml testdata/
3434
gsutil cp gs://minikube-builds/${MINIKUBE_LOCATION}/testdata/busybox-mount-test.yaml testdata/
3535

3636
# Add the out/ directory to the PATH, for using new drivers.
37-
export PATH=$PATH:"$(pwd)/out/"
37+
export PATH="$(pwd)/out/":$PATH
3838

3939
# Linux cleanup
4040
virsh -c qemu:///system list --all \

pkg/minikube/drivers/hyperkit/disk.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/docker/machine/libmachine/mcnutils"
2727
)
2828

29-
func createDiskImage(sshKeyPath, diskPath string, diskSize int) error {
29+
func createDiskImage(sshKeyPath, diskPath string, diskSizeMb int) error {
3030
tarBuf, err := mcnutils.MakeDiskImage(sshKeyPath)
3131
if err != nil {
3232
return err
@@ -44,7 +44,7 @@ func createDiskImage(sshKeyPath, diskPath string, diskSize int) error {
4444
}
4545
file.Close()
4646

47-
if err := os.Truncate(diskPath, int64(diskSize*1048576)); err != nil {
47+
if err := os.Truncate(diskPath, int64(diskSizeMb*1000000)); err != nil {
4848
return err
4949
}
5050
return nil

pkg/minikube/drivers/hyperkit/disk_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Test_createDiskImage(t *testing.T) {
3434
diskPath := filepath.Join(tmpdir, "disk")
3535

3636
sizeInMb := 100
37-
sizeInBytes := int64(sizeInMb) * 1048576
37+
sizeInBytes := int64(sizeInMb) * 1000000
3838
if err := createDiskImage(sshPath, diskPath, sizeInMb); err != nil {
3939
t.Errorf("createDiskImage() error = %v", err)
4040
}

pkg/minikube/drivers/hyperkit/iso.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@ func ReadFile(isoPath, srcPath string) (string, error) {
7676
}
7777

7878
func findFile(r *iso9660.Reader, path string) (os.FileInfo, error) {
79+
// Look through the ISO for a file with a matching path.
7980
for f, err := r.Next(); err != io.EOF; f, err = r.Next() {
80-
// Some files get an extra ',' at the end.
81+
// For some reason file paths in the ISO sometimes contain a '.' character at the end, so strip that off.
8182
if strings.TrimSuffix(f.Name(), ".") == path {
8283
return f, nil
8384
}
8485
}
85-
return nil, fmt.Errorf("Unable to find file %s.", path)
86+
return nil, fmt.Errorf("unable to find file %s", path)
8687
}

pkg/minikube/drivers/hyperkit/network_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ var validLeases = []byte(`{
3838
hw_address=1,a4:b5:c6:d7:e8:f9
3939
identifier=1,a0:b0:c0:d0:e0:f0
4040
lease=0x597e1267
41+
}
42+
{
43+
name=bar
44+
ip_address=192.168.64.4
45+
hw_address=1,a5:b6:c7:d8:e9:f1
46+
identifier=1,a5:b6:c7:d8:e9:f1
47+
lease=0x597e1268
4148
}`)
4249

4350
func Test_getIpAddressFromFile(t *testing.T) {
@@ -66,6 +73,12 @@ func Test_getIpAddressFromFile(t *testing.T) {
6673
"1.2.3.4",
6774
false,
6875
},
76+
{
77+
"duplicate",
78+
args{"a4:b5:c6:d7:e8:f9", dhcpFile},
79+
"192.168.64.3",
80+
false,
81+
},
6982
{
7083
"invalid",
7184
args{"a1:b2:c3:d4:e5:f6", invalidFile},

0 commit comments

Comments
 (0)