Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kola: Extend test to cover recreation of files in /etc #488

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion kola/tests/misc/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ func init() {

// Check that the overlay doesn't have unexpected upcopies, e.g., due to
// systemd-tmpfiles recreating the files/dirs or similar. Also check
// that duplicates get removed on reboot.
// that duplicates get removed on reboot. We also want certain files
// to be recreated, e.g., those with a tmpfile rule.
func OverlayCleanup(c cluster.TestCluster) {
m := c.Machines()[0]

Expand All @@ -83,6 +84,9 @@ func OverlayCleanup(c cluster.TestCluster) {
// All these files should not be part of the tmpfiles rules for the test to work.
_ = c.MustSSH(m, `sudo rm -r /etc/sssd && sudo mkdir /etc/sssd && sudo chmod 700 /etc/sssd && sudo rm /etc/kexec.conf && sudo rm -rf /etc/samba && sudo rm -r /etc/bash && sudo cp -a /usr/share/flatcar/etc/bash /etc/bash && sudo touch /etc/bash/hello`)

// Test that /etc/resolv.conf will be recreated when removed
_ = c.MustSSH(m, `sudo rm /etc/resolv.conf`)

// The migration path for old machines with a full /etc and the cleanup of unwanted duplicates/
// upcopies can be tested the same way by copying duplicates to /etc and then rebooting to
// check that they get cleaned up.
Expand All @@ -93,6 +97,7 @@ func OverlayCleanup(c cluster.TestCluster) {

_ = c.MustSSH(m, fmt.Sprintf(overlayCheck, "after reboot"))
_ = c.MustSSH(m, `if sudo test -e /etc/sssd/sssd.conf || test -e /etc/kexec.conf || test -e /etc/samba || test ! -e /etc/bash/hello || test ! -e /etc/bash/bashrc ; then echo "Deletion or modification lost: $_" ; exit 1; fi`)
_ = 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`)
}

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