1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2025-08-08 09:55:44 +00:00
os-autoinst-distri-fedora/tests/upgrade_run.pm
2021-12-10 12:57:03 +01:00

114 lines
3.7 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");
}
if (get_var("GUI_UPGRADE")) {
# Get back to the desktop
desktop_vt();
# If the desktop is Gnome
if (get_var("DESKTOP") eq "gnome") {
desktop_login(get_var("USER_LOGIN"), get_var("USER_PASSWORD"));
# Start Gnome software
menu_launch_type("gnome-software");
# If it is run for the first time, hit the Browse button to
# speed things up.
if (check_screen("gnome_software_browse_button", timeout => 60)) {
assert_and_click("gnome_software_browse_button");
}
# Click on the updates button. There should be no updates available,
# as updates were already handled by the upgrade_preinstall test,
# so we should only see the new version banner.
assert_and_click("gnome_software_updates_button", timeout=>60);
# Check that the banner is there.
assert_screen("gnome_software_new_version");
# Click on the Download button to download the new version.
assert_and_click("gnome_software_new_download");
# Wait until it gets downloaded. It can take a long time, so
# we will do regular checks.
wait_until_needlematch("gnome_software_new_install", 10, 600);
# Click to Install the updates
assert_and_click("gnome_software_new_install");
if (check_screen("gnome_software_authenticate", timeout => 60)) {
# If authentication dialogue, then authenticate
type_safely(get_var("USER_PASSWORD"));
send_key("ret");
}
else {
die("There was no authentication dialogue requested for an activity where it should have been.");
}
assert_and_click("gnome_software_restart");
}
}
else {
# 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";
}
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: