Skip to content

Commit

Permalink
Add test for bootupd/bootc ostree containers
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirSlavik committed Dec 12, 2023
1 parent 5a73841 commit 5ee5331
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
44 changes: 44 additions & 0 deletions rpm-ostree-container-bootc.ks.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#test name: rpm-ostree-container-bootc
# for bootc/bootupd
# depends on the referenced ostree container being bootable

# Use the default settings.
%ksappend common/common_no_payload.ks

# Set up the RPM OSTree source.
ostreecontainer --no-signature-verification --url=quay.io/centos-bootc/fedora-bootc:eln

# Reboot the installed system.
reboot

# Validate on the first boot.
%ksappend validation/success_on_first_boot.ks

%post

# Checks in %post
# Check the url of the remote.
url="$(ostree remote show-url default)"
if [ "${url}" != "quay.io/centos-bootc/fedora-bootc:eln" ]; then
echo "Unexpected URL: ${url}" >> /root/RESULT
fi

# Checks after boot
cat > /etc/kickstart-test.sh << 'EOF'

# propagate any errors from %post validations
if [ -e /root/RESULT ]; then
cat /root/RESULT
fi

# Check that bootupd information is present
if [ ! -e /boot/bootupd-state.json ]; then
echo "/boot/bootupd-state.json not found on installed system after booting"
fi

bootupctl --help || echo "bootupctl command not available after booting"
bootc --help || echo "bootc command not available after booting"

EOF

%end
53 changes: 53 additions & 0 deletions rpm-ostree-container-bootc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Copyright (C) 2023 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details. You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#

# Ignore unused variable parsed out by tooling scripts as test tags metadata
# shellcheck disable=SC2034
TESTTYPE="payload ostree bootc reboot skip-on-rhel"

. ${KSTESTDIR}/functions.sh

kernel_args() {
# Enforce the Fedora-Silverblue configuration.
echo ${DEFAULT_BOOTOPTS} inst.profile=fedora-silverblue
}

validate() {
# We are not able to copy files from the system.
# Look for the result in the logs we have.
local disksdir=$1
cat "${disksdir}/virt-install.log" | grep -q "SUCCESS"

if [[ $? != 0 ]]; then
status=1
echo '*** The test has failed.'
return 1
fi

return 0
}

get_timeout() {
echo "120"
}

additional_runner_args() {
# Wait for reboot and shutdown of the VM,
# but exit after the specified timeout.
echo "--wait $(get_timeout)"
}

0 comments on commit 5ee5331

Please sign in to comment.