Skip to content

Commit 97bd57c

Browse files
committed
kola: Support default confext for /etc
When we switch from a custom overlay mount for /etc to using systemd-confext there are a few minor differences with unmounting /etc from a new namespace for inspection and when checking extension paths that are now resolved when being symlinks. Also add a new test for making sure that the confext/sysext skipping works. Signed-off-by: Kai Lueke <kailuke@microsoft.com>
1 parent 00e124f commit 97bd57c

3 files changed

Lines changed: 25 additions & 8 deletions

File tree

kola/tests/misc/state.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func OverlayCleanup(c cluster.TestCluster) {
6969
// systemd-tmpfiles to cause any recreation at boot: This was observed with C, L, and d entries
7070
// (file or tree copy, symlink setup, directory creation) and thus they are dropped during image
7171
// build as workaround.
72-
overlayCheck := `sudo unshare -m bash -c 'umount /etc || { echo "Could not unmount /etc"; exit 1; }; if test -e "/etc/hosts" || test -e "/etc/security" || test -e "/etc/profile.d" || test -e "/etc/shells" || test -e "/etc/os-release" ; then echo "Unexpected overlay copy in /etc %s: $_" ; exit 1; fi'`
72+
overlayCheck := `sudo unshare -m bash -c 'umount -l /etc || { echo "Could not unmount /etc"; exit 1; }; if test -e "/etc/hosts" || test -e "/etc/security" || test -e "/etc/profile.d" || test -e "/etc/shells" || test -e "/etc/os-release" ; then echo "Unexpected overlay copy in /etc %s: $_" ; exit 1; fi'`
7373
_ = c.MustSSH(m, fmt.Sprintf(overlayCheck, "on initial boot"))
7474

7575
// Do some local modifications that are expected to be kept:
@@ -92,14 +92,14 @@ func OverlayCleanup(c cluster.TestCluster) {
9292
// The migration path for old machines with a full /etc and the cleanup of unwanted duplicates/
9393
// upcopies can be tested the same way by copying duplicates to /etc and then rebooting to
9494
// check that they get cleaned up.
95-
_ = c.MustSSH(m, `sudo unshare -m bash -c 'umount /etc && cp -a /usr/share/flatcar/etc/{hosts,shells,os-release} /etc/ && mkdir /etc/security /etc/profile.d'`)
95+
_ = c.MustSSH(m, `sudo unshare -m bash -c 'umount -l /etc && cp -a /usr/share/flatcar/etc/{hosts,shells,os-release} /etc/ && mkdir /etc/security /etc/profile.d'`)
9696
if err := m.Reboot(); err != nil {
9797
c.Fatalf("could not reboot: %v", err)
9898
}
9999

100100
_ = c.MustSSH(m, fmt.Sprintf(overlayCheck, "after reboot"))
101101
_ = c.MustSSH(m, `if sudo test -e /etc/sssd/sssd.conf || test -e /etc/kexec.conf || test -e /etc/wireguard || test ! -e /etc/bash/hello || test ! -e /etc/bash/bashrc ; then echo "Deletion or modification lost: $_" ; exit 1; fi`)
102-
_ = c.MustSSH(m, `if test ! -e /etc/resolv.conf ; then echo "Files with tmpfile rule not recreated: $_" ; exit 1; fi && if ! sudo unshare -m bash -c 'umount /etc && test ! -e /etc/resolv.conf'; then echo "File with tmpfile rule exists as upcopy: $_"; exit 1; fi`)
102+
_ = c.MustSSH(m, `if test ! -e /etc/resolv.conf ; then echo "Files with tmpfile rule not recreated: $_" ; exit 1; fi && if ! sudo unshare -m bash -c 'umount -l /etc && test ! -e /etc/resolv.conf'; then echo "File with tmpfile rule exists as upcopy: $_"; exit 1; fi`)
103103
}
104104

105105
// Check the OS reset logic with flatcar-reset to be able to

kola/tests/sysext/sysext.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ if [[ "${oem_test_type}" != 'raw' ]]; then
125125
fi
126126
127127
oem_test_path=$(jq --raw-output '.path' <<<"${list_oem_test}")
128-
if [[ "${oem_test_path}" != '/etc/extensions/oem-test.raw' ]]; then
129-
echo "oem test image path should be '/etc/extensions/oem-test.raw', is '${oem_test_path}'"
128+
oem_test_real_path=$(readlink -f /etc/extensions/oem-test.raw)
129+
if [[ "${oem_test_path}" != "${oem_test_real_path}" ]] && [[ "${oem_test_path}" != '/etc/extensions/oem-test.raw' ]]; then
130+
echo "oem test image path should be '${oem_test_real_path}' or '/etc/extensions/oem-test.raw', is '${oem_test_path}'"
130131
exit 1
131132
fi
132133
@@ -239,6 +240,14 @@ func init() {
239240
inline: |
240241
sysext works`),
241242
})
243+
register.Register(&register.Test{
244+
Name: "confext.skiprefresh",
245+
Run: checkConfextSkipRefresh,
246+
ClusterSize: 1,
247+
Distros: []string{"cl"},
248+
// This test is normally not related to the cloud environment
249+
Platforms: []string{"qemu", "qemu-unpriv"},
250+
MinVersion: semver.Version{Major: 4548}})
242251
register.Register(&register.Test{
243252
Name: "sysext.custom-docker.torcx",
244253
Run: checkSysextCustomDocker,
@@ -324,6 +333,12 @@ func checkSysextSimple(c cluster.TestCluster, oemMountpoint string) {
324333
checkHelper(c, oemMountpoint)
325334
}
326335

336+
func checkConfextSkipRefresh(c cluster.TestCluster) {
337+
// This test uses no extra extension images
338+
_ = c.MustSSH(c.Machines()[0], `if sudo journalctl -u systemd-confext -b0 | grep "Merged extensions into"; then echo "Unexpected confext merge, expected skip" ; exit 1 ; fi`)
339+
_ = c.MustSSH(c.Machines()[0], `if ! findmnt -O rw --target /etc >/dev/null; then echo "Missing or wrong /etc mount, expected rw"; exit 1; fi`)
340+
}
341+
327342
func checkSysextCustomDocker(c cluster.TestCluster) {
328343
arch := strings.SplitN(kola.QEMUOptions.Board, "-", 2)[0]
329344
if arch == "arm64" {
@@ -341,13 +356,14 @@ func checkSysextCustomDocker(c cluster.TestCluster) {
341356
// Flatcar has no mksquashfs and btrfs is missing a bugfix but at least ext4 works
342357
// The first test is for a fixed Docker version, which with the time will get old and older but is still expected to work because users may also "freeze" their Docker version this way
343358
_ = c.MustSSH(c.Machines()[0], fmt.Sprintf(`ARCH=%[1]s ONLY_DOCKER=1 FORMAT=ext4 sysext-bakery/create_docker_sysext.sh 20.10.21 docker && ARCH=%[1]s ONLY_CONTAINERD=1 FORMAT=ext4 sysext-bakery/create_docker_sysext.sh 20.10.21 containerd && sudo mv docker.raw containerd.raw /etc/extensions/`, arch))
344-
_ = c.MustSSH(c.Machines()[0], `sudo systemctl restart systemd-sysext`)
359+
// Explicit daemon-reload and docker start because the old bake.sh does not set EXTENSION_RELOAD_MANAGER=1
360+
_ = c.MustSSH(c.Machines()[0], `sudo systemctl restart systemd-sysext && sudo systemctl daemon-reload`)
345361
// We should now be able to use Docker
346362
_ = c.MustSSH(c.Machines()[0], cmdWorking)
347363
// The next test is with a recent Docker version, here the one from the Flatcar image to couple it to something that doesn't change under our feet
348364
version := string(c.MustSSH(c.Machines()[0], `bzcat /usr/share/licenses/licenses.json.bz2 | grep -m 1 -o 'app-\(containers\|emulation\)/docker-[0-9][^:]*' | cut -d - -f 3`))
349365
_ = c.MustSSH(c.Machines()[0], fmt.Sprintf(`ONLY_DOCKER=1 FORMAT=ext4 ARCH=%[2]s sysext-bakery/create_docker_sysext.sh %[1]s docker && ONLY_CONTAINERD=1 FORMAT=ext4 ARCH=%[2]s sysext-bakery/create_docker_sysext.sh %[1]s containerd && sudo mv docker.raw containerd.raw /etc/extensions/`, version, arch))
350-
_ = c.MustSSH(c.Machines()[0], `sudo systemctl restart systemd-sysext && sudo systemctl restart docker containerd`)
366+
_ = c.MustSSH(c.Machines()[0], `sudo systemctl restart systemd-sysext && sudo systemctl daemon-reload && sudo systemctl restart docker containerd`)
351367
// We should now still be able to use Docker
352368
_ = c.MustSSH(c.Machines()[0], cmdWorking)
353369
}

kola/tests/update/update.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ func sysextBootLogic(c cluster.TestCluster, oemMountpoint string) {
548548
// a) stored on the rootfs and will stay there and the new one is is moved to the OEM partition
549549
// b) stored on the OEM partition and gets moved to the rootfs and the new one is moved to the OEM partition
550550
_ = c.MustSSH(noIgnition, fmt.Sprintf(`set -euxo pipefail
551-
sudo systemctl mask --now systemd-sysext ensure-sysext
551+
sudo systemctl mask --now ensure-sysext || true # Old releases
552+
sudo systemctl mask --now systemd-sysext
552553
sudo mkdir -p /etc/flatcar/sysext /etc/flatcar/oem-sysext %[2]s/sysext /etc/extensions
553554
echo ID=test | sudo tee %[2]s/oem-release
554555
echo myext | sudo tee /etc/flatcar/enabled-sysext.conf

0 commit comments

Comments
 (0)