Skip to content

Commit

Permalink
Update pre-install test for new modularization
Browse files Browse the repository at this point in the history
Due to modularization it was necessary to make a change in the tests because the triggered error from the module shows
a traceback in the log, which automatically terminates the test at --erroronfail. So the temporary solution is to test
the test without this parameter, and look for the error in the log.
  • Loading branch information
adamkankovsky committed Nov 6, 2024
1 parent a93ede6 commit 45ccc30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
21 changes: 8 additions & 13 deletions script-pre-install.ks.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Test name: pre_install_interpreter_and_error_test

%ksappend repos/default.ks
%ksappend common/common_no_payload.ks
%ksappend payload/default_packages.ks
text --non-interactive
bootloader --timeout=1
zerombr
clearpart --all --initlabel
autopart
rootpw --plaintext testpasswords
reboot

# First pre-install script using Python interpreter
%pre-install --interpreter=/usr/bin/python3 --log=/mnt/sysroot/root/preinstall_python.log
Expand All @@ -12,16 +15,8 @@ with open("/mnt/sysroot/root/preinstall_python.log", "a") as log_file:
%end

# Second pre-install script with intentional error
%pre-install --erroronfail --log=/mnt/sysroot/root/preinstall_error.log
%pre-install --log=/mnt/sysroot/root/preinstall_error.log
echo "SUCCESS"
echo "Logging from bash pre-install script" >> /mnt/sysroot/root/preinstall_error.log
shutdown +1
exit 1
%end

# Pre-install script that should be unreachable
%pre-install
echo "Unreachable code" >> /mnt/sysroot/root/preinstall_error.log
%end

text
7 changes: 3 additions & 4 deletions script-pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ validate() {
status=1
fi

# Ensure that the "Unreachable code" message is NOT present.
grep -q "Unreachable code" "${disksdir}/virt-install.log"
if [[ $? == 0 ]]; then
echo '*** ERROR: The test failed because unreachable code was executed after "exit 1".'
# Check for the specific error message in the virt-install.log
if ! grep -q "kickstart.script: Error code 1 running the kickstart script" "${disksdir}/virt-install.log"; then
echo '*** ERROR: Expected error message "kickstart.script: Error code 1 running the kickstart script" not found in virt-install.log.'
status=1
fi

Expand Down

0 comments on commit 45ccc30

Please sign in to comment.