From a9a715c8145278cdd156daccdc78c9d45f97c8c8 Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Thu, 8 Jul 2021 10:49:27 -0700 Subject: [PATCH 1/6] Use "amd64" instead of "aarch64" in .deb package for kvm2/arm64 driver --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 29f8822abe0e..6454b532081a 100644 --- a/Makefile +++ b/Makefile @@ -797,7 +797,7 @@ out/docker-machine-driver-kvm2-aarch64: out/docker-machine-driver-kvm2-arm64 out/docker-machine-driver-kvm2_$(DEB_VERSION).deb: out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_amd64.deb cp $< $@ -out/docker-machine-driver-kvm2_$(DEB_VERSION)-$(DEB_REVISION)_arm64.deb: out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_aarch64.deb +out/docker-machine-driver-kvm2_$(DEB_VERSION)-$(DEB_REVISION)_arm64.deb: out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_arm64.deb cp $< $@ out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_%.deb: out/docker-machine-driver-kvm2-% From 93cbfb702de9cc3445d6162d96ee822cbb62c37e Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Thu, 8 Jul 2021 10:49:59 -0700 Subject: [PATCH 2/6] update TestDebPackageInstall to test linux/arm64 packages too --- test/integration/pkg_install_test.go | 73 ++++++++++++++++------------ 1 file changed, 42 insertions(+), 31 deletions(-) diff --git a/test/integration/pkg_install_test.go b/test/integration/pkg_install_test.go index ca500e41a4ab..b2619dff482c 100644 --- a/test/integration/pkg_install_test.go +++ b/test/integration/pkg_install_test.go @@ -33,12 +33,13 @@ var distros = []string{ "debian:10", "debian:9", "ubuntu:latest", + "ubuntu:21.04", "ubuntu:20.10", "ubuntu:20.04", "ubuntu:18.04", } -var timeout = Minutes(10) +var timeout = Minutes(16) // TestPackageInstall tests installation of .deb packages with minikube itself and with kvm2 driver // on various debian/ubuntu docker images @@ -56,53 +57,63 @@ func TestDebPackageInstall(t *testing.T) { if err != nil { t.Errorf("failed to get minikube path: %v", err) } - mkDebs, err := filepath.Glob(fmt.Sprintf("%s/minikube_*_%s.deb", pkgDir, runtime.GOARCH)) - if err != nil { - t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) - } - kvmDebs, err := filepath.Glob(fmt.Sprintf("%s/docker-machine-driver-kvm2_*_%s.deb", pkgDir, runtime.GOARCH)) - if err != nil { - t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) - } for _, distro := range distros { distroImg := distro testName := fmt.Sprintf("install_%s_%s", runtime.GOARCH, distroImg) t.Run(testName, func(t *testing.T) { - // apt-get update; dpkg -i minikube_${ver}_${arch}.deb - t.Run("minikube", func(t *testing.T) { - for _, mkDeb := range mkDebs { - rr, err := dpkgInstall(ctx, t, distro, mkDeb) - if err != nil || rr.ExitCode != 0 { - t.Errorf("failed to install %q on %q: err=%v, exit=%d", - mkDeb, distroImg, err, rr.ExitCode) - } + for _, arch := range []string{"amd64", "arm64"} { + + mkDebs, err := filepath.Glob(fmt.Sprintf("%s/minikube_*_%s.deb", pkgDir, arch)) + if err != nil { + t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) } - }) - // apt-get update; apt-get install -y libvirt0; dpkg -i docker-machine-driver-kvm2_${ver}_${arch}.deb - t.Run("kvm2-driver", func(t *testing.T) { - for _, kvmDeb := range kvmDebs { - rr, err := dpkgInstallDriver(ctx, t, distro, kvmDeb) - if err != nil || rr.ExitCode != 0 { - t.Errorf("failed to install %q on %q: err=%v, exit=%d", - kvmDeb, distroImg, err, rr.ExitCode) - } + kvmDebs, err := filepath.Glob(fmt.Sprintf("%s/docker-machine-driver-kvm2_*_%s.deb", pkgDir, arch)) + if err != nil { + t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) } - }) + + // Check minikube installation + t.Run("minikube", func(t *testing.T) { + for _, mkDeb := range mkDebs { + // apt-get update; dpkg -i minikube_${ver}_${arch}.deb + rr, err := dpkgInstall(ctx, t, distro, arch, mkDeb) + if err != nil || rr.ExitCode != 0 { + t.Errorf("failed to install %q on %q: err=%v, exit=%d", + mkDeb, distroImg, err, rr.ExitCode) + } + } + }) + // Check kvm2 drivers installation + t.Run("kvm2-driver", func(t *testing.T) { + for _, kvmDeb := range kvmDebs { + // apt-get update; apt-get install -y libvirt0; dpkg -i docker-machine-driver-kvm2_${ver}_${arch}.deb + rr, err := dpkgInstallDriver(ctx, t, distro, arch, kvmDeb) + if err != nil || rr.ExitCode != 0 { + t.Errorf("failed to install %q on %q: err=%v, exit=%d", + kvmDeb, distroImg, err, rr.ExitCode) + } + } + }) + } }) } } -func dpkgInstall(ctx context.Context, t *testing.T, image, deb string) (*RunResult, error) { +func dpkgInstall(ctx context.Context, t *testing.T, image, arch, deb string) (*RunResult, error) { return Run(t, exec.CommandContext(ctx, - "docker", "run", "--rm", fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), + "docker", "run", "--rm", + fmt.Sprintf("--platform=linux/%s", arch), + fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), image, "sh", "-c", fmt.Sprintf("apt-get update; dpkg -i /var/tmp/%s", filepath.Base(deb)))) } -func dpkgInstallDriver(ctx context.Context, t *testing.T, image, deb string) (*RunResult, error) { +func dpkgInstallDriver(ctx context.Context, t *testing.T, image, arch, deb string) (*RunResult, error) { return Run(t, exec.CommandContext(ctx, - "docker", "run", "--rm", fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), + "docker", "run", "--rm", + fmt.Sprintf("--platform=linux/%s", arch), + fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), image, "sh", "-c", fmt.Sprintf("apt-get update; apt-get install -y libvirt0; dpkg -i /var/tmp/%s", filepath.Base(deb)))) } From 3cbccb206292cb18c8f75dace1bab96329e1dbbe Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Thu, 8 Jul 2021 11:30:52 -0700 Subject: [PATCH 3/6] fix Makefile --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index 6454b532081a..5fce61484ce5 100644 --- a/Makefile +++ b/Makefile @@ -797,9 +797,6 @@ out/docker-machine-driver-kvm2-aarch64: out/docker-machine-driver-kvm2-arm64 out/docker-machine-driver-kvm2_$(DEB_VERSION).deb: out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_amd64.deb cp $< $@ -out/docker-machine-driver-kvm2_$(DEB_VERSION)-$(DEB_REVISION)_arm64.deb: out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_arm64.deb - cp $< $@ - out/docker-machine-driver-kvm2_$(DEB_VERSION)-0_%.deb: out/docker-machine-driver-kvm2-% cp -r installers/linux/deb/kvm2_deb_template out/docker-machine-driver-kvm2_$(DEB_VERSION) chmod 0755 out/docker-machine-driver-kvm2_$(DEB_VERSION)/DEBIAN From 137e056f657a90c71b8f790b7f3f5d8b0d8e88d2 Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Thu, 8 Jul 2021 12:49:32 -0700 Subject: [PATCH 4/6] Revert cross-platform testing - not supported on our CI --- test/integration/pkg_install_test.go | 72 ++++++++++++---------------- 1 file changed, 31 insertions(+), 41 deletions(-) diff --git a/test/integration/pkg_install_test.go b/test/integration/pkg_install_test.go index b2619dff482c..1ecec8ed0830 100644 --- a/test/integration/pkg_install_test.go +++ b/test/integration/pkg_install_test.go @@ -39,7 +39,7 @@ var distros = []string{ "ubuntu:18.04", } -var timeout = Minutes(16) +var timeout = Minutes(10) // TestPackageInstall tests installation of .deb packages with minikube itself and with kvm2 driver // on various debian/ubuntu docker images @@ -57,63 +57,53 @@ func TestDebPackageInstall(t *testing.T) { if err != nil { t.Errorf("failed to get minikube path: %v", err) } + mkDebs, err := filepath.Glob(fmt.Sprintf("%s/minikube_*_%s.deb", pkgDir, runtime.GOARCH)) + if err != nil { + t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) + } + kvmDebs, err := filepath.Glob(fmt.Sprintf("%s/docker-machine-driver-kvm2_*_%s.deb", pkgDir, runtime.GOARCH)) + if err != nil { + t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) + } for _, distro := range distros { distroImg := distro testName := fmt.Sprintf("install_%s_%s", runtime.GOARCH, distroImg) t.Run(testName, func(t *testing.T) { - for _, arch := range []string{"amd64", "arm64"} { - - mkDebs, err := filepath.Glob(fmt.Sprintf("%s/minikube_*_%s.deb", pkgDir, arch)) - if err != nil { - t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) - } - kvmDebs, err := filepath.Glob(fmt.Sprintf("%s/docker-machine-driver-kvm2_*_%s.deb", pkgDir, arch)) - if err != nil { - t.Errorf("failed to find minikube deb in %q: %v", pkgDir, err) - } - - // Check minikube installation - t.Run("minikube", func(t *testing.T) { - for _, mkDeb := range mkDebs { - // apt-get update; dpkg -i minikube_${ver}_${arch}.deb - rr, err := dpkgInstall(ctx, t, distro, arch, mkDeb) - if err != nil || rr.ExitCode != 0 { - t.Errorf("failed to install %q on %q: err=%v, exit=%d", - mkDeb, distroImg, err, rr.ExitCode) - } + // apt-get update; dpkg -i minikube_${ver}_${arch}.deb + t.Run("minikube", func(t *testing.T) { + for _, mkDeb := range mkDebs { + rr, err := dpkgInstall(ctx, t, distro, mkDeb) + if err != nil || rr.ExitCode != 0 { + t.Errorf("failed to install %q on %q: err=%v, exit=%d", + mkDeb, distroImg, err, rr.ExitCode) } - }) - // Check kvm2 drivers installation - t.Run("kvm2-driver", func(t *testing.T) { - for _, kvmDeb := range kvmDebs { - // apt-get update; apt-get install -y libvirt0; dpkg -i docker-machine-driver-kvm2_${ver}_${arch}.deb - rr, err := dpkgInstallDriver(ctx, t, distro, arch, kvmDeb) - if err != nil || rr.ExitCode != 0 { - t.Errorf("failed to install %q on %q: err=%v, exit=%d", - kvmDeb, distroImg, err, rr.ExitCode) - } + } + }) + // apt-get update; apt-get install -y libvirt0; dpkg -i docker-machine-driver-kvm2_${ver}_${arch}.deb + t.Run("kvm2-driver", func(t *testing.T) { + for _, kvmDeb := range kvmDebs { + rr, err := dpkgInstallDriver(ctx, t, distro, kvmDeb) + if err != nil || rr.ExitCode != 0 { + t.Errorf("failed to install %q on %q: err=%v, exit=%d", + kvmDeb, distroImg, err, rr.ExitCode) } - }) - } + } + }) }) } } -func dpkgInstall(ctx context.Context, t *testing.T, image, arch, deb string) (*RunResult, error) { +func dpkgInstall(ctx context.Context, t *testing.T, image, deb string) (*RunResult, error) { return Run(t, exec.CommandContext(ctx, - "docker", "run", "--rm", - fmt.Sprintf("--platform=linux/%s", arch), - fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), + "docker", "run", "--rm", fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), image, "sh", "-c", fmt.Sprintf("apt-get update; dpkg -i /var/tmp/%s", filepath.Base(deb)))) } -func dpkgInstallDriver(ctx context.Context, t *testing.T, image, arch, deb string) (*RunResult, error) { +func dpkgInstallDriver(ctx context.Context, t *testing.T, image, deb string) (*RunResult, error) { return Run(t, exec.CommandContext(ctx, - "docker", "run", "--rm", - fmt.Sprintf("--platform=linux/%s", arch), - fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), + "docker", "run", "--rm", "", fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), image, "sh", "-c", fmt.Sprintf("apt-get update; apt-get install -y libvirt0; dpkg -i /var/tmp/%s", filepath.Base(deb)))) } From f3848eea129843ada61e640786cbbb27b989d216 Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Thu, 8 Jul 2021 14:09:41 -0700 Subject: [PATCH 5/6] fix test --- test/integration/pkg_install_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/pkg_install_test.go b/test/integration/pkg_install_test.go index 1ecec8ed0830..8b555a001ecb 100644 --- a/test/integration/pkg_install_test.go +++ b/test/integration/pkg_install_test.go @@ -103,7 +103,7 @@ func dpkgInstall(ctx context.Context, t *testing.T, image, deb string) (*RunResu func dpkgInstallDriver(ctx context.Context, t *testing.T, image, deb string) (*RunResult, error) { return Run(t, exec.CommandContext(ctx, - "docker", "run", "--rm", "", fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), + "docker", "run", "--rm", fmt.Sprintf("-v%s:/var/tmp", filepath.Dir(deb)), image, "sh", "-c", fmt.Sprintf("apt-get update; apt-get install -y libvirt0; dpkg -i /var/tmp/%s", filepath.Base(deb)))) } From e6ead596ea27d7d2288a5bc04c235771f9e67962 Mon Sep 17 00:00:00 2001 From: Ilya Zuyev Date: Fri, 9 Jul 2021 11:19:08 -0700 Subject: [PATCH 6/6] remove ubuntu:21.04 --- test/integration/pkg_install_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/test/integration/pkg_install_test.go b/test/integration/pkg_install_test.go index 8b555a001ecb..ca500e41a4ab 100644 --- a/test/integration/pkg_install_test.go +++ b/test/integration/pkg_install_test.go @@ -33,7 +33,6 @@ var distros = []string{ "debian:10", "debian:9", "ubuntu:latest", - "ubuntu:21.04", "ubuntu:20.10", "ubuntu:20.04", "ubuntu:18.04",