1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-08-04 16:05:44 +00:00
os-autoinst-distri-fedora/tests/upgrade_run.pm
Adam Williamson 27b2859339 Upgrades: don't install target release packages in repo_setup
F42 to F43 upgrades suddenly started failing, and I think this
is why - we actually wind up installing packages from the target
release in setup_repos (called from repo_setup), because we set
up the buildroot repo then run some dnf commands. Let's tweak
that so for upgrade tests we create the buildroot repo disabled
at first, then enable it in upgrade_run.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2025-07-10 00:18:54 -07:00

64 lines
2.0 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
my $relnum = get_release_number;
my $rawrel = get_var("RAWREL");
# disable screen blanking (download can take a long time)
script_run "setterm -blank 0";
# use compose repo (compose tests) or set up update repo (update tests)
cleanup_workaround_repo;
repo_setup();
# enable the buildroot repo now, if relevant
assert_script_run 'sed -i -e "s,enabled=0,enabled=1,g" /etc/yum.repos.d/buildroot.repo' if (get_var("BUILDROOT_REPO"));
my $params = "-y --best --releasever=${relnum}";
if (script_run "dnf ${params} system-upgrade download", 6000) {
record_soft_failure "dnf failed so retry with --allowerasing";
if ($relnum < 41) {
assert_script_run "dnf ${params} --allowerasing system-upgrade download", 6000;
}
else {
assert_script_run "dnf ${params} system-upgrade download --allowerasing", 6000;
}
}
upload_logs "/var/log/dnf.log", failok => 1;
upload_logs "/var/log/dnf5.log", failok => 1;
upload_logs "/var/log/dnf.rpm.log", failok => 1;
script_run "dnf -y system-upgrade reboot", 0;
# fail immediately if we see a DNF error message, but keep an eye
# out for the bootloader so we can handle it if requested
check_screen ["upgrade_fail", "bootloader"], 15;
die "DNF reported failure" if (match_has_tag "upgrade_fail");
# handle bootloader, if requested; set longer timeout as sometimes
# reboot here seems to take a long time
if (get_var("GRUB_POSTINSTALL")) {
do_bootloader(postinstall => 1, params => get_var("GRUB_POSTINSTALL"), timeout => 120);
}
# decrypt, if encrypted
if (get_var("ENCRYPT_PASSWORD")) {
boot_decrypt(120);
# in encrypted case we need to wait a bit so postinstall test
# doesn't bogus match on the encryption prompt we just completed
# before it disappears from view
sleep 5;
}
}
sub test_flags {
return {fatal => 1};
}
1;
# vim: set sw=4 et: