1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-11-21 21:43:08 +00:00
os-autoinst-distri-fedora/tests/upgrade_run.pm

58 lines
1.7 KiB
Perl
Raw Normal View History

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
2016-01-28 05:40:07 +00:00
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 mirrorlist instead of baseurl for updates tests The reason we have all this horrible code to use the commented- out baseurl lines in the repo files instead of the metalinks that are usually used is a timing issue with the metalink system. As a protection against stale mirrors, the metalink system sends the package manager a list of mirrors *and a list of recent checksums for the repo metadata*. The package manager goes out and gets the metadata from the first mirror on the list, then checksums it; if the checksum isn't on the list of checksums it got from mirrormanager, it assumes that means the mirror is stale, and tries the next on the list instead. The problem is that MM's list of checksums is currently only updated once an hour (by a cron job). So we kept running into a problem where, when a test ran just after one of the repos had been regenerated, the infra mirror it's supposed to use would be rejected because the checksum wasn't on the list - but not because the mirror was stale, but because it was too fresh, it had got the new packages and metadata but mirrormanager's list of checksums hadn't been updated to include the checksum for the latest metadata. All this baseurl munging code was getting ridiculous, though, what with the tests getting more complicated and errors showing up in the actual repo files and stuff. It occurred to me that instead of using the baseurl we can just use the 'mirrorlist' system instead of 'metalink'. mirrorlist is the dumber, older system which just provides the package manager a list of mirrors and nothing else - the whole stale-mirror-detection-checksum thing does not happen with mirrorlists, the package manager just tries all the mirrors in order and uses the first that works. And happily, it's very easy to convert the metalink URLs into mirrorlist URLs, and it saves all that faffing around trying to fix up baseurls. Also, adjust upgrade_boot to do the s/metalink/mirrorlist/ substitution, so upgrade tests don't run into the timing issue in the steps before the main repo_setup run is done by upgrade_run, and adjust repo_setup_compose to sub this line out later. Signed-off-by: Adam Williamson <awilliam@redhat.com>
2018-05-09 19:35:59 +00:00
# use compose repo (compose tests) or set up update repo (update tests)
cleanup_workaround_repo;
repo_setup();
my $params = "-y --releasever=${relnum}";
if (script_run "dnf ${params} system-upgrade download", 6000) {
record_soft_failure "dnf failed so retry with --allowerasing";
$params .= " --allowerasing";
assert_script_run "dnf ${params} system-upgrade download", 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: