mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2025-08-12 11:35:43 +00:00
Fix bugs and finish the test. Add to templates. Add methods to provide packages to update. Experiment with the logic. Experiment with the logic. Reprogram the update test. Save progress. Save progress.
107 lines
3.2 KiB
Perl
107 lines
3.2 KiB
Perl
use base "installedtest";
|
|
use strict;
|
|
use testapi;
|
|
use utils;
|
|
use packagetest;
|
|
|
|
sub cockpit_update {
|
|
# This routine starts the Cockpit, logs in, and goes to the update page.
|
|
# run firefox and login to cockpit
|
|
start_cockpit(1);
|
|
# go to the updates screen
|
|
assert_and_click "cockpit_software_updates", '', 120;
|
|
# wait for the updates to download
|
|
while (!check_screen('cockpit_updates_check',1)) {
|
|
sleep 5;
|
|
}
|
|
}
|
|
|
|
sub run {
|
|
my $self=shift;
|
|
bypass_1691487;
|
|
# Test if updates are available for the system -> if they are not
|
|
# prepare test packages that provide a possibilty to update
|
|
# something (See lib/packagetest.pm).
|
|
|
|
script_run "dnf check-update ; echo \$? > status";
|
|
my $result = script_output "cat status";
|
|
my $cockdate = "0";
|
|
if ($result eq "0") {
|
|
print "INFO: DNF did not find any packages to update. Will continue using modified packages.";
|
|
prepare_test_packages;
|
|
verify_installed_packages;
|
|
}
|
|
elsif ($result eq "100") {
|
|
print "INFO: DNF found packages to update. Will continue with real packages.";
|
|
# When Cockpit is updated through cockpit, the interface gets disconnected
|
|
# and the user logged out. Let us check if that is the situation.
|
|
}
|
|
else {
|
|
record_soft_failure "DNF returned an error exit code. I will try to run the test anyway.";
|
|
}
|
|
|
|
# Start Cockpit
|
|
cockpit_update;
|
|
|
|
|
|
# If security updates are available, install them first,
|
|
# so that we test the most buttons in one go.
|
|
# After updates, ignore restart because we do not need
|
|
# restarting the machine to continue. Also, we would have
|
|
# to deal with much more complicated workflow.
|
|
#
|
|
if (check_screen('cockpit_updates_security_install',1)) {
|
|
assert_and_click 'cockpit_updates_security_install';
|
|
sleep 60; # wait until things are installed
|
|
assert_and_click 'cockpit_updates_restart_ignore';
|
|
wait_still_screen 2;
|
|
}
|
|
|
|
|
|
# Install the rest of the updates, or any updates
|
|
# that have not been previously installed.
|
|
assert_and_click 'cockpit_updates_all_install';
|
|
my $run = 0;
|
|
while ($run < 40) {
|
|
# When Cockpit packages are also included in the updates
|
|
# the user is forced to reconnect, i.e. to restart the Web Application
|
|
# and relog for further interaction. We will check if reconnection is
|
|
# needed and if so, we will restart Firefox and login again.
|
|
#
|
|
if (check_screen("cockpit_updates_reconnect", 1)) {
|
|
send_key "ctrl-q";
|
|
sleep 5;
|
|
cockpit_update;
|
|
$run = 50;
|
|
|
|
}
|
|
elsif (check_screen('cockpit_updates_restart_ignore', 1)) {
|
|
# ignore restart, because we have not finished yet
|
|
assert_and_click 'cockpit_updates_restart_ignore';
|
|
$run = 50;
|
|
}
|
|
else {
|
|
sleep 10;
|
|
$run = $run + 1;
|
|
}
|
|
}
|
|
# Check that the system is updated
|
|
assert_screen 'cockpit_updates_updated';
|
|
|
|
# Switch off Cockpit
|
|
send_key "ctrl-q";
|
|
|
|
if ($result eq "0") {
|
|
verify_updated_packages;
|
|
}
|
|
|
|
}
|
|
|
|
sub test_flags {
|
|
return { always_rollback => 1 };
|
|
}
|
|
|
|
1;
|
|
|
|
# vim: set sw=4 et:
|