test: Wait for systemd-resolved to be ready on Ubuntu 22.04 for s390x

On new Ubuntu 22.04 images, stopping systemd-resolved to get the
dhclient script override resolv.conf doesn't work anymore. I
originally used that hack to avoid introducing a delay which is
needed when running it on TCG.

Keep systemd-resolved running instead, and wait for it to be ready
by retrying to resolve a domain a few times before installing
packages, so that we don't add another ugly delay that might
unnecessarily slow down things even further.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2022-09-05 14:32:14 +02:00
parent 7ce9fd165f
commit c880747883

View file

@ -54,6 +54,11 @@ hout INIT_MSG cat /tmp/init_msg
check [ __INIT_MSG__ = "from_ns" ]
endef
# With systemd-resolved and TCG, DNS might take a while to work
def dns_ready_wait
host r=10; while [ \${r} -gt 0 ]; do host ubuntu.com && break; sleep 5; r=\$((r - 1)); done
endef
# Start passt, set common variables
hostb ./passt -P __PIDFILE__ &
sleep 1
@ -185,11 +190,10 @@ test Ubuntu 22.04 (Jammy Jellyfish), s390x
host ./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nographic __BASEPATH__/prepared-jammy-server-cloudimg-s390x.img -net socket,fd=5 -net nic,model=virtio -device virtio-rng-ccw -snapshot
host service systemd-resolved stop
host export DEBIAN_FRONTEND=noninteractive
host apt-get -y remove needrestart snapd
host dhclient -4
sleep 2
dns_ready_wait
host apt-get update
host apt-get -y install make gcc socat