-
Notifications
You must be signed in to change notification settings - Fork 36
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
New test - rpm-ostree-container-bootc + related improvements #1096
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#test name: rpm-ostree-container-bootc | ||
# for bootc/bootupd, remote and stateroot ostreecontainer options | ||
# depends on the referenced ostree container being bootable | ||
|
||
# Use the default settings. | ||
%ksappend common/common_no_payload.ks | ||
|
||
# The RPM OSTree source is set up by the test script | ||
|
||
# Reboot the installed system. | ||
reboot | ||
|
||
# Validate on the first boot. | ||
%ksappend validation/success_on_first_boot.ks | ||
|
||
%post | ||
# Checks in %post | ||
# Check of the remote URL is appended by the test script | ||
|
||
# Checks after boot | ||
cat >> /opt/kickstart-tests/kickstart-test.sh << 'EOF' | ||
|
||
# propagate any errors from %post validations | ||
if [ -e /root/RESULT ]; then | ||
cat /root/RESULT | ||
fi | ||
|
||
# Check that state root 'test-stateroot' exists | ||
if [ ! -d /ostree/deploy/test-stateroot ]; then | ||
echo "Couldn't find 'test-stateroot' stateroot" | ||
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 &> /dev/null || echo "bootupctl command not available after booting" | ||
bootc --help &> /dev/null || echo "bootc command not available after booting" | ||
|
||
EOF | ||
%end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# | ||
# 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-8 skip-on-rhel-10" | ||
# skip-on-rhel" | ||
|
||
. ${KSTESTDIR}/functions.sh | ||
|
||
os_major=${KSTEST_OS_VERSION%%.*} | ||
if [ "${KSTEST_OS_NAME}" == "rhel" ]; then | ||
container_url="quay.io/centos-bootc/centos-bootc:stream${os_major}" | ||
else | ||
container_url="quay.io/centos-bootc/fedora-bootc:eln" | ||
fi | ||
|
||
copy_interesting_files_from_system() { | ||
local disksdir | ||
disksdir="${1}" | ||
|
||
# Find disks. | ||
local args | ||
args=$(for d in ${disksdir}/disk-*img; do echo -a ${d}; done) | ||
|
||
# Use also iscsi disk if there is any. | ||
if [[ -n ${iscsi_disk_img} ]]; then | ||
args="${args} -a ${disksdir}/${iscsi_disk_img}" | ||
fi | ||
|
||
# Grab files out of the installed system while it still exists. | ||
# Grab these files: | ||
# | ||
# logs from Anaconda - whole /var/log/anaconda/ directory is copied out, | ||
# this can be used for saving specific test output | ||
# original-ks.cfg - the kickstart used for the test | ||
# anaconda-ks.cfg - the kickstart saved after installation, useful for | ||
# debugging | ||
# RESULT - file from the test | ||
# | ||
# The location of aforementioned files is different in an ostree system | ||
|
||
root_device=$(guestfish ${args} <<< " | ||
launch | ||
lvs" | \ | ||
grep root) | ||
|
||
for item in /ostree/deploy/test-stateroot/var/roothome/original-ks.cfg \ | ||
/ostree/deploy/test-stateroot/var/roothome/anaconda-ks.cfg \ | ||
/ostree/deploy/test-stateroot/var/roothome/anabot.log \ | ||
/ostree/deploy/test-stateroot/var/log/anaconda/ \ | ||
/ostree/deploy/test-stateroot/var/roothome/RESULT | ||
do | ||
guestfish ${args} <<< " | ||
launch | ||
mount ${root_device} / | ||
copy-out '${item}' '${disksdir}' | ||
" 2>/dev/null | ||
done | ||
} | ||
|
||
prepare() { | ||
ks=${1} | ||
cat >> ${ks} << EOF1 | ||
ostreecontainer --no-signature-verification --remote=test-remote --stateroot=test-stateroot --url=${container_url} | ||
|
||
%post | ||
cat >> /var/lib/extensions/kickstart-tests/usr/libexec/kickstart-test.sh << EOF2 | ||
remote_url="\\\$(ostree remote show-url test-remote)" | ||
if [ \\\${?} -ne 0 ]; then | ||
echo "Couldn't list remote URL for 'test-remote'" >> /root/RESULT | ||
fi | ||
|
||
if [ "\\\${remote_url}" != "${container_url}" ]; then | ||
echo "Unexpected URL: \\\${remote_url}, expected ${container_url}" >> /root/RESULT | ||
fi | ||
EOF2 | ||
%end | ||
EOF1 | ||
echo ${ks} | ||
} | ||
|
||
get_timeout() { | ||
echo "80" | ||
} | ||
|
||
additional_runner_args() { | ||
# Wait for reboot and shutdown of the VM, | ||
# but exit after the specified timeout. | ||
echo "--wait $(get_timeout)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part was failing for me with file not found, updated here: #1116