os-autoinst-distri-rocky/tests/upgrade_run.pm
Adam Williamson acc46464f8 Revise release variable handling, prerelease checks, os-release
I started out trying to fix os-release for the recent change to
add "Prerelease" tags to the VERSION and PRETTY_NAME fields, then
things spiralled. It got me thinking about the awkward DEVELOPMENT
variable we use, so I decided to get rid of it and refactor the
few things that use it. I refactored the anaconda prerelease tag
check, and wrote a new giant comment that gives details about
exactly how anaconda decides whether to show those tags, to give
context to our choices about when to expect them. This check now
uses a new LABEL variable the scheduler now sets. I also wound up
creating new UP1REL and UP2REL vars to define the 'source' release
for upgrade tests, separate from CURRREL and PREVREL, which are
now never lies - they really are the current stable and previous
stable release, even for update upgrade tests.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2020-05-07 15:42:08 -07:00

69 lines
2.1 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
sub run {
my $self = shift;
my $release = lc(get_var("VERSION"));
my $relnum = $release;
if ($release eq "rawhide") {
$relnum = get_var("RAWREL", "rawhide");
}
# 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();
my $params = "-y --releasever=${relnum}";
if ($release eq "rawhide") {
$params .= " --nogpgcheck";
}
# FIXME workaround for #1811234 affecting F30 -> F31 upgrades
# remove when bug is fixed or F30 goes EOL
if (get_var("UPGRADE") && $relnum eq "31" && get_var("UP1REL") eq "30") {
assert_script_run "dnf -y module reset maven", 120;
}
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";
upload_logs "/var/log/dnf.rpm.log";
script_run "dnf 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: