From 45ccc3053fc3eebc0318438246f11918d95dba15 Mon Sep 17 00:00:00 2001 From: Adam Kankovsky Date: Wed, 6 Nov 2024 14:24:23 +0100 Subject: [PATCH] Update pre-install test for new modularization 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. --- script-pre-install.ks.in | 21 ++++++++------------- script-pre-install.sh | 7 +++---- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/script-pre-install.ks.in b/script-pre-install.ks.in index 3d822882..b358bf16 100644 --- a/script-pre-install.ks.in +++ b/script-pre-install.ks.in @@ -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 @@ -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 diff --git a/script-pre-install.sh b/script-pre-install.sh index d71d13b6..7f6ce32c 100755 --- a/script-pre-install.sh +++ b/script-pre-install.sh @@ -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