Add .deb installation tests
parent
ee6283ecf1
commit
8a651ba6bd
|
@ -25,8 +25,7 @@ jobs:
|
||||||
run: go mod download
|
run: go mod download
|
||||||
- name: Build Binaries
|
- name: Build Binaries
|
||||||
run: |
|
run: |
|
||||||
make cross
|
make cross e2e-cross debs
|
||||||
make e2e-cross
|
|
||||||
cp -r test/integration/testdata ./out
|
cp -r test/integration/testdata ./out
|
||||||
whoami
|
whoami
|
||||||
echo github ref $GITHUB_REF
|
echo github ref $GITHUB_REF
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -487,6 +487,13 @@ verify-iso: # Make sure the current ISO exists in the expected bucket
|
||||||
out/docs/minikube.md: $(shell find "cmd") $(shell find "pkg/minikube/constants") $(SOURCE_GENERATED)
|
out/docs/minikube.md: $(shell find "cmd") $(shell find "pkg/minikube/constants") $(SOURCE_GENERATED)
|
||||||
go run -ldflags="$(MINIKUBE_LDFLAGS)" -tags gendocs hack/help_text/gen_help_text.go
|
go run -ldflags="$(MINIKUBE_LDFLAGS)" -tags gendocs hack/help_text/gen_help_text.go
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: debs
|
||||||
|
debs: out/minikube_$(DEB_VERSION)-$(DEB_REVISION)_amd64.deb \
|
||||||
|
out/minikube_$(DEB_VERSION)-$(DEB_REVISION)_arm64.deb \
|
||||||
|
out/docker-machine-driver-kvm2_$(DEB_VERSION).deb
|
||||||
|
|
||||||
|
|
||||||
.PHONY: deb_version
|
.PHONY: deb_version
|
||||||
deb_version:
|
deb_version:
|
||||||
@echo $(DEB_VERSION)-$(DEB_REVISION)
|
@echo $(DEB_VERSION)-$(DEB_REVISION)
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# This script builds the minikube binary for all 3 platforms and uploads them.
|
||||||
|
# This is to done as part of the CI tests for Github PRs
|
||||||
|
|
||||||
|
# The script expects the following env variables:
|
||||||
|
# bucket: The GCP bucket to get .deb files from
|
||||||
|
# debs: .deb packages to test
|
||||||
|
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
trap exit SIGINT
|
||||||
|
|
||||||
|
for pkg in ${debs[@]}; do
|
||||||
|
gsutil cp -r "gs://${bucket}/${pkg}.deb" .
|
||||||
|
done
|
||||||
|
|
||||||
|
declare -ra distros=(\
|
||||||
|
debian:sid\
|
||||||
|
debian:latest\
|
||||||
|
debian:buster\
|
||||||
|
debian:stretch\
|
||||||
|
ubuntu:latest\
|
||||||
|
ubuntu:20.10 \
|
||||||
|
ubuntu:20.04 \
|
||||||
|
ubuntu:19.10 \
|
||||||
|
ubuntu:19.04 \
|
||||||
|
ubuntu:18.10 \
|
||||||
|
ubuntu:18.04)
|
||||||
|
|
||||||
|
|
||||||
|
for distro in "${distros[@]}"; do
|
||||||
|
for pkg in ${debs[@]}; do
|
||||||
|
echo "=============================================================="
|
||||||
|
printf "Install %s on %s\n" "${pkg}" "${distro}"
|
||||||
|
echo "=============================================================="
|
||||||
|
docker run --rm -v "$PWD:/var/tmp" "${distro}" sh -c "apt-get update; \
|
||||||
|
(dpkg -i /var/tmp/${pkg} ||
|
||||||
|
(apt-get -fy install && dpkg -i /var/tmp/${pkg}))
|
||||||
|
|| echo "Failed to install ${pkg}.deb on ${distro}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
// build integration
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors All rights reserved.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package integration
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
var distros = []string{
|
||||||
|
"debian:sid",
|
||||||
|
"debian:latest",
|
||||||
|
"debian:10",
|
||||||
|
"debian:9",
|
||||||
|
//
|
||||||
|
"ubuntu:latest",
|
||||||
|
"ubuntu:20.10",
|
||||||
|
"ubuntu:20.04",
|
||||||
|
"ubuntu:19.10",
|
||||||
|
"ubuntu:19.04",
|
||||||
|
}
|
||||||
|
|
||||||
|
var timeout = Minutes(10)
|
||||||
|
|
||||||
|
|
||||||
|
// TestPackageInstall tests installation of .deb packages with minikube itself and with kvm2 driver
|
||||||
|
// on debian/ubuntu docker images enumerated in "distros"
|
||||||
|
func TestDebPackageInstall(t *testing.T) {
|
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
pkgDir, err := filepath.Abs(filepath.Dir(Target()))
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed to get minikube path: %e", err)
|
||||||
|
}
|
||||||
|
mkDebs, err := filepath.Glob(fmt.Sprintf("%s/minikube_*_%s.deb", pkgDir, "amd64"))
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("failed to find minikube deb in %q: %e", 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: %e", pkgDir, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, distro := range distros {
|
||||||
|
distroImg := distro
|
||||||
|
t.Run("installMinikube_"+distroImg, 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=%e, exit=%d",
|
||||||
|
mkDeb, 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=%e, exit=%d",
|
||||||
|
kvmDeb, distroImg, err, rr.ExitCode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func dpkgInstall(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)),
|
||||||
|
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) {
|
||||||
|
return Run(t, exec.CommandContext(ctx,
|
||||||
|
"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))))
|
||||||
|
}
|
Loading…
Reference in New Issue