os-autoinst-distri-rocky/tests/server_cockpit_updates.pm
Lukas Ruzicka d82f4ecd7f Develop a new test for system updates via Cockpit.
* server-cockpit-updates tests that Cockpit can be used to update the system.
* server-cockpit-autoupdate tests that users can use dnf-automatic for system
updates.
* cockpit functions were removed from utils.pm and put into an extra library
for cockpit - cockpit.pm which all cockpit tests are now using.

Review cockpit.pm

Review autoupdate test.

Review the update test.

Fix typo in cockpit.pm

Add sleep.

Add missing command.

Delete an unused needle.
2019-10-01 16:04:01 +02:00

87 lines
2.5 KiB
Perl

use base "installedtest";
use strict;
use testapi;
use utils;
use packagetest;
use cockpit;
sub run {
my $self=shift;
bypass_1691487;
my $cockdate = "0";
# Remove a package, disable repositories and enable test repositories, install the package
# from that repository to make the system outdated and verify that that package was
# correctly installed.
prepare_test_packages;
verify_installed_packages;
# Start Cockpit
start_cockpit(1);
# Navigate to update screen
select_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;
start_cockpit(1);
select_cockpit_update();
$run = 50;
}
# Ignore rebooting the system because we want to finish the test instead.
elsif (check_screen('cockpit_updates_restart_ignore', 1)) {
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";
# Wait a couple of seconds for the terminal to settle down, the command was
# entered incorrectly which resulted in a failure.
sleep 5;
# Verify that the test package was updated correctly.
verify_updated_packages;
}
sub test_flags {
return { always_rollback => 1 };
}
1;
# vim: set sw=4 et: