Skip to content

Commit

Permalink
e2e: add support for distro=sles
Browse files Browse the repository at this point in the history
  • Loading branch information
askervin committed Aug 6, 2021
1 parent 73524c4 commit 31a6dcd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
38 changes: 31 additions & 7 deletions demo/lib/distro.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ distro-refresh-pkg-db() { distro-resolve "$@"; }
distro-install-pkg() { distro-resolve "$@"; }
distro-remove-pkg() { distro-resolve "$@"; }
distro-setup-proxies() { distro-resolve "$@"; }
distro-install-utils() { distro-resolve "$@"; }
distro-install-golang() { distro-resolve "$@"; }
distro-install-containerd() { distro-resolve "$@"; }
distro-config-containerd() { distro-resolve "$@"; }
Expand Down Expand Up @@ -78,6 +79,7 @@ distro-resolve-fn() {
centos*) candidates="$candidates fedora-$apifn rpm-$apifn";;
fedora*) candidates="$candidates rpm-$apifn";;
*suse*) candidates="$candidates rpm-$apifn";;
sles*) candidates="$candidates opensuse-$apifn rpm-$apifn";;
esac
case $apifn in
*-pre|*-post) ;;
Expand Down Expand Up @@ -398,11 +400,26 @@ EOF
###########################################################################

#
# OpenSUSE 15.2
# OpenSUSE 15.2 and SLES
#

ZYPPER="zypper --non-interactive --no-gpg-checks"

sles-image-url() {
echo "/DOWNLOAD-MANUALLY-TO-HOME/vms/images/SLES15-SP3-JeOS.x86_64-15.3-OpenStack-Cloud-GM.qcow2"
}

sles-ssh-user() {
echo "sles"
}

sles-install-utils() {
vm-command-q "$ZYPPER lr openSUSE-Oss >/dev/null" || {
distro-install-repo http://download.opensuse.org/distribution/leap/15.3/repo/oss/ openSUSE-Oss
}
distro-install-pkg sysvinit-tools psmisc
}

opensuse-image-url() {
echo "https://download.opensuse.org/repositories/Cloud:/Images:/Leap_15.2/images/openSUSE-Leap-15.2-OpenStack.x86_64-0.0.4-Build8.25.qcow2"
}
Expand Down Expand Up @@ -438,12 +455,12 @@ opensuse-remove-pkg() {
}

opensuse-install-golang() {
opensuse-install-pkg wget tar gzip git-core
distro-install-pkg wget tar gzip git-core
from-tarball-install-golang
}

opensuse-wait-for-zypper() {
vm-run-until --timeout 5 '( ! pidof zypper >/dev/null ) || ( killall zypper; sleep 1; exit 1 )' ||
vm-run-until --timeout 5 '( ! pgrep zypper >/dev/null ) || ( pkill -9 zypper; sleep 1; exit 1 )' ||
error "Failed to stop zypper running in the background"
}

Expand All @@ -458,7 +475,7 @@ opensuse-install-containerd() {
opensuse-install-repo https://download.opensuse.org/repositories/Virtualization:containers/openSUSE_Leap_15.2/Virtualization:containers.repo
opensuse-refresh-pkg-db
fi
opensuse-install-pkg --from Virtualization_containers containerd containerd-ctr
distro-install-pkg --from Virtualization_containers containerd containerd-ctr
vm-command "ln -sf /usr/sbin/containerd-ctr /usr/sbin/ctr"

cat <<EOF |
Expand Down Expand Up @@ -497,9 +514,9 @@ opensuse-install-k8s() {
vm-command "echo 1 > /proc/sys/net/ipv4/ip_forward"
vm-command "zypper ls"
if ! grep -q snappy <<< "$COMMAND_OUTPUT"; then
opensuse-install-repo "http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2 snappy"
opensuse-refresh-pkg-db
opensuse-install-pkg "snapd apparmor-profiles socat ebtables cri-tools conntrackd"
distro-install-repo "http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.2 snappy"
distro-refresh-pkg-db
distro-install-pkg "snapd apparmor-profiles socat ebtables cri-tools conntrackd iptables ethtool"
fi
vm-install-containernetworking
vm-command "systemctl enable --now snapd"
Expand Down Expand Up @@ -642,6 +659,13 @@ EOF
done
}

default-install-utils() {
# $distro-install-utils() is responsible for installing common
# utilities, such as pidof and killall, that the test framework
# and tests in general can expect to be found on VM.
:
}

default-k8s-cni() {
echo cilium
}
Expand Down
12 changes: 12 additions & 0 deletions demo/lib/vm.bash
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,18 @@ vm-install-pkg() {
distro-install-pkg "$@"
}

vm-setup-oneshot() {
local util
distro-refresh-pkg-db
distro-install-utils
# Verify that all required utilities exit on the VM.
for util in pidof killall; do
vm-command-q "command -v $util >/dev/null" || {
error "required command '$util' missing on VM, fix/implement $distro-install-utils()"
}
done
}

vm-install-golang() {
distro-install-golang
}
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,11 @@ fi

is-hooked "on_vm_online" && run-hook "on_vm_online"

if [ "$reinstall_oneshot" == "1" ] || ! vm-command-q "[ -f .vm-setup-oneshot ]"; then
vm-setup-oneshot
vm-command-q "touch .vm-setup-oneshot"
fi

if [ -n "$vm_files" ]; then
install-files "$vm_files"
fi
Expand Down

0 comments on commit 31a6dcd

Please sign in to comment.