Skip to content

Commit

Permalink
tests: remove broken checks
Browse files Browse the repository at this point in the history
The tests used incorrect syntax to check for the presence of systemctl, which
meant all futher commands were never executed. Since we no longer test on
non-systemd systems, we can fix the check and error out if no systemctl is
found.

Also, if the system is using ifup/ifdown or similar configuration, the init
targets for networking might fail when a network-config is present for
cloud-init. As this is always the case in our e2e tests, just reset
those targets.

Apparmor service also often fails to start on certain systems, so we
just remove it for our e2e tests in the provisioning steps.

We also exclude debian-9 (Stretch) from e2e tests: cloud-init is so
old that it fails to parse the network-config v2, stopping the whole
initialization. We don't test or build against that anymore, so
it should be fine to exclude.
  • Loading branch information
WanzenBug committed Jul 1, 2022
1 parent 3a965a0 commit 17531a3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ e2e-test:
# amazonlinux: times out because it starts updates on boot
# centos-6: repos offline
# centos-8: repos offline
EXCLUDED: amazonlinux-2|centos-6|centos-8
# debian-9: no longer supported, and cloud-init so old it crashes when a network-config is provided
EXCLUDED: amazonlinux-2|centos-6|centos-8|debian-9
tags:
- libvirt
script:
Expand Down
3 changes: 3 additions & 0 deletions tests/provision.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ set -ex
if command -v apt-get ; then
apt-get update
apt-get install -y rsync hostname
apt-get purge -y apparmor
elif command -v dnf ; then
dnf install -y rsync hostname
elif command -v yum ; then
yum install -y rsync hostname
fi
systemctl mask kdump.service
if command -v snap ; then
# Snap likes to block VM shutdown
apt-get remove -y snapd
Expand Down
13 changes: 6 additions & 7 deletions tests/test-run.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ test -f /virter/example.txt
cd /virter
sha256sum -c example.txt.sha256sum
# CentOS 6 doesn't use systemd, Upstart is a mess, so don't even bother...
command -v systemctl || exit 0
command -v systemctl || exit 1
# Need to reset this state, as ifup fails when devices are configured that do not exist on the node.
systemctl reset-failed "network*.service" || true
while true; do
running=$(systemctl is-system-running || true)
Expand All @@ -62,16 +64,13 @@ NR_ADDRS=0
while read IDX NAME ; do
case "$NAME" in
lo)
# Skip loopback
# Default interface, must have IP and should be up
ip -oneline -4 addr show dev $NAME | grep -q "inet" || exit 1
ip -oneline link show dev $NAME | grep -q "state UP" || exit 1
# skip loopback interface
;;
eth*|enp*s0)
# Should have IP address, and be online
ip -oneline -4 addr show dev $NAME | grep -q "inet" || exit 1
ip -oneline link show dev $NAME | grep -q "state UP" || exit 1
NR_ADDRS=$(($NR_ADDRS + 1)
NR_ADDRS=$(($NR_ADDRS + 1))
;;
*)
echo Unexpected network interface $NAME 1>&2
Expand Down

0 comments on commit 17531a3

Please sign in to comment.