From 27d626094803340eb55f58feda3694d4217b5b9d Mon Sep 17 00:00:00 2001 From: Lukas Ruzicka Date: Jun 05 2019 14:04:22 +0000 Subject: Create updates tests for Cockpit. 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. --- diff --git a/needles/cockpit/cockpit_software_updates.json b/needles/cockpit/cockpit_software_updates.json new file mode 100644 index 0000000..cab4b5d --- /dev/null +++ b/needles/cockpit/cockpit_software_updates.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_software_updates" + ], + "area": [ + { + "xpos": 68, + "ypos": 538, + "width": 51, + "height": 18, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_software_updates.png b/needles/cockpit/cockpit_software_updates.png new file mode 100644 index 0000000..8ae42cd Binary files /dev/null and b/needles/cockpit/cockpit_software_updates.png differ diff --git a/needles/cockpit/cockpit_updates_all_install.json b/needles/cockpit/cockpit_updates_all_install.json new file mode 100644 index 0000000..063c22c --- /dev/null +++ b/needles/cockpit/cockpit_updates_all_install.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_all_install" + ], + "area": [ + { + "xpos": 778, + "ypos": 266, + "width": 56, + "height": 17, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_all_install.png b/needles/cockpit/cockpit_updates_all_install.png new file mode 100644 index 0000000..4df44d2 Binary files /dev/null and b/needles/cockpit/cockpit_updates_all_install.png differ diff --git a/needles/cockpit/cockpit_updates_auto-20190529.json b/needles/cockpit/cockpit_updates_auto-20190529.json new file mode 100644 index 0000000..677158f --- /dev/null +++ b/needles/cockpit/cockpit_updates_auto-20190529.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "height": 34, + "type": "match", + "ypos": 190, + "width": 48, + "xpos": 468 + } + ], + "properties": [], + "tags": [ + "cockpit_updates_auto" + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_auto-20190529.png b/needles/cockpit/cockpit_updates_auto-20190529.png new file mode 100644 index 0000000..010073f Binary files /dev/null and b/needles/cockpit/cockpit_updates_auto-20190529.png differ diff --git a/needles/cockpit/cockpit_updates_auto.json b/needles/cockpit/cockpit_updates_auto.json new file mode 100644 index 0000000..acd8516 --- /dev/null +++ b/needles/cockpit/cockpit_updates_auto.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_auto" + ], + "area": [ + { + "xpos": 443, + "ypos": 204, + "width": 29, + "height": 17, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_auto.png b/needles/cockpit/cockpit_updates_auto.png new file mode 100644 index 0000000..ffda854 Binary files /dev/null and b/needles/cockpit/cockpit_updates_auto.png differ diff --git a/needles/cockpit/cockpit_updates_auto_on.json b/needles/cockpit/cockpit_updates_auto_on.json new file mode 100644 index 0000000..ad3dc22 --- /dev/null +++ b/needles/cockpit/cockpit_updates_auto_on.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_auto_on" + ], + "area": [ + { + "xpos": 368, + "ypos": 199, + "width": 66, + "height": 27, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_auto_on.png b/needles/cockpit/cockpit_updates_auto_on.png new file mode 100644 index 0000000..e795013 Binary files /dev/null and b/needles/cockpit/cockpit_updates_auto_on.png differ diff --git a/needles/cockpit/cockpit_updates_available.json b/needles/cockpit/cockpit_updates_available.json new file mode 100644 index 0000000..3c41539 --- /dev/null +++ b/needles/cockpit/cockpit_updates_available.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_available" + ], + "area": [ + { + "xpos": 264, + "ypos": 259, + "width": 185, + "height": 28, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_available.png b/needles/cockpit/cockpit_updates_available.png new file mode 100644 index 0000000..e4784ae Binary files /dev/null and b/needles/cockpit/cockpit_updates_available.png differ diff --git a/needles/cockpit/cockpit_updates_check.json b/needles/cockpit/cockpit_updates_check.json new file mode 100644 index 0000000..a2183ac --- /dev/null +++ b/needles/cockpit/cockpit_updates_check.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_check" + ], + "area": [ + { + "xpos": 787, + "ypos": 142, + "width": 110, + "height": 18, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_check.png b/needles/cockpit/cockpit_updates_check.png new file mode 100644 index 0000000..1b85064 Binary files /dev/null and b/needles/cockpit/cockpit_updates_check.png differ diff --git a/needles/cockpit/cockpit_updates_console_update.json b/needles/cockpit/cockpit_updates_console_update.json new file mode 100644 index 0000000..0c7d9b6 --- /dev/null +++ b/needles/cockpit/cockpit_updates_console_update.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 304, + "ypos": 309, + "width": 143, + "height": 17, + "type": "match" + } + ], + "properties": [], + "tags": [ + "cockpit_updates_console_update" + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_console_update.png b/needles/cockpit/cockpit_updates_console_update.png new file mode 100644 index 0000000..496616c Binary files /dev/null and b/needles/cockpit/cockpit_updates_console_update.png differ diff --git a/needles/cockpit/cockpit_updates_dnf_install.json b/needles/cockpit/cockpit_updates_dnf_install.json new file mode 100644 index 0000000..d36588d --- /dev/null +++ b/needles/cockpit/cockpit_updates_dnf_install.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_dnf_install" + ], + "area": [ + { + "xpos": 846, + "ypos": 274, + "width": 43, + "height": 17, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_dnf_install.png b/needles/cockpit/cockpit_updates_dnf_install.png new file mode 100644 index 0000000..5bdb61b Binary files /dev/null and b/needles/cockpit/cockpit_updates_dnf_install.png differ diff --git a/needles/cockpit/cockpit_updates_reconnect.json b/needles/cockpit/cockpit_updates_reconnect.json new file mode 100644 index 0000000..db991a2 --- /dev/null +++ b/needles/cockpit/cockpit_updates_reconnect.json @@ -0,0 +1,15 @@ +{ + "area": [ + { + "xpos": 565, + "ypos": 381, + "width": 75, + "height": 19, + "type": "match" + } + ], + "properties": [], + "tags": [ + "cockpit_updates_reconnect" + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_reconnect.png b/needles/cockpit/cockpit_updates_reconnect.png new file mode 100644 index 0000000..afc28c6 Binary files /dev/null and b/needles/cockpit/cockpit_updates_reconnect.png differ diff --git a/needles/cockpit/cockpit_updates_restart_confirm.json b/needles/cockpit/cockpit_updates_restart_confirm.json new file mode 100644 index 0000000..bad9aab --- /dev/null +++ b/needles/cockpit/cockpit_updates_restart_confirm.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_restart_confirm" + ], + "area": [ + { + "xpos": 576, + "ypos": 260, + "width": 46, + "height": 15, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_restart_confirm.png b/needles/cockpit/cockpit_updates_restart_confirm.png new file mode 100644 index 0000000..9a5f2d7 Binary files /dev/null and b/needles/cockpit/cockpit_updates_restart_confirm.png differ diff --git a/needles/cockpit/cockpit_updates_restart_ignore.json b/needles/cockpit/cockpit_updates_restart_ignore.json new file mode 100644 index 0000000..bb457a2 --- /dev/null +++ b/needles/cockpit/cockpit_updates_restart_ignore.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_restart_ignore" + ], + "area": [ + { + "xpos": 519, + "ypos": 260, + "width": 43, + "height": 16, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_restart_ignore.png b/needles/cockpit/cockpit_updates_restart_ignore.png new file mode 100644 index 0000000..e93c6c0 Binary files /dev/null and b/needles/cockpit/cockpit_updates_restart_ignore.png differ diff --git a/needles/cockpit/cockpit_updates_security_install.json b/needles/cockpit/cockpit_updates_security_install.json new file mode 100644 index 0000000..c215f0a --- /dev/null +++ b/needles/cockpit/cockpit_updates_security_install.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_security_install" + ], + "area": [ + { + "xpos": 619, + "ypos": 267, + "width": 93, + "height": 16, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_security_install.png b/needles/cockpit/cockpit_updates_security_install.png new file mode 100644 index 0000000..c7600fa Binary files /dev/null and b/needles/cockpit/cockpit_updates_security_install.png differ diff --git a/needles/cockpit/cockpit_updates_updated.json b/needles/cockpit/cockpit_updates_updated.json new file mode 100644 index 0000000..f165c72 --- /dev/null +++ b/needles/cockpit/cockpit_updates_updated.json @@ -0,0 +1,15 @@ +{ + "properties": [], + "tags": [ + "cockpit_updates_updated" + ], + "area": [ + { + "xpos": 524, + "ypos": 276, + "width": 56, + "height": 43, + "type": "match" + } + ] +} \ No newline at end of file diff --git a/needles/cockpit/cockpit_updates_updated.png b/needles/cockpit/cockpit_updates_updated.png new file mode 100644 index 0000000..03d9a8e Binary files /dev/null and b/needles/cockpit/cockpit_updates_updated.png differ diff --git a/templates b/templates index ab33d47..dc5f331 100755 --- a/templates +++ b/templates @@ -785,6 +785,17 @@ flavor => "Server-dvd-iso", version => "*", }, + test_suite => { name => "server_cockpit_updates" }, + }, + { + machine => { name => "64bit" }, + prio => 30, + product => { + arch => "x86_64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, test_suite => { name => "realmd_join_cockpit" }, }, { @@ -2216,6 +2227,18 @@ flavor => "Server-dvd-iso", version => "*", }, + test_suite => { name => "server_cockpit_updates" }, + }, + { + group_name => "Fedora PowerPC", + machine => { name => "ppc64le" }, + prio => 30, + product => { + arch => "ppc64le", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, test_suite => { name => "server_cockpit_basic" }, }, { @@ -3032,6 +3055,18 @@ flavor => "Server-dvd-iso", version => "*", }, + test_suite => { name => "server_cockpit_updates" }, + }, + { + group_name => "Fedora PowerPC", + machine => { name => "ppc64" }, + prio => 30, + product => { + arch => "ppc64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, test_suite => { name => "realmd_join_cockpit" }, }, { @@ -3872,6 +3907,18 @@ flavor => "Server-dvd-iso", version => "*", }, + test_suite => { name => "server_cockpit_updates }, + }, + { + group_name => "Fedora AArch64", + machine => { name => "aarch64" }, + prio => 30, + product => { + arch => "aarch64", + distri => "fedora", + flavor => "Server-dvd-iso", + version => "*", + }, test_suite => { name => "realmd_join_cockpit" }, }, { @@ -5641,6 +5688,20 @@ ], }, { + name => "server_cockpit_updates", + settings => [ + { key => "POSTINSTALL", value => "server_cockpit_updates" }, + { key => "USER_LOGIN", value => "false" }, + { key => "ROOT_PASSWORD", value => "weakpassword" }, + # to understand the '+' values in this test and the next, + # see the `jobs_from_update` docstring in fedora_openqa + # schedule.py + { key => "+START_AFTER_TEST", value => "server_cockpit_default" }, + { key => "BOOTFROM", value => "c" }, + { key => "+HDD_1", value => "disk_%MACHINE%_cockpit.qcow2" }, + ], + }, + { name => "realmd_join_cockpit", settings => [ { key => "POSTINSTALL", value => "realmd_join_cockpit freeipa_webui freeipa_password_change freeipa_client" }, diff --git a/tests/server_cockpit_autoupdate.pm b/tests/server_cockpit_autoupdate.pm new file mode 100644 index 0000000..306dad1 --- /dev/null +++ b/tests/server_cockpit_autoupdate.pm @@ -0,0 +1,39 @@ +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; + + # Start Cockpit + cockpit_update; + + # Switch on automatic updates + assert_and_click 'cockpit_updates_auto', '', 120; + assert_and_click 'cockpit_updates_dnf_install', '', 120; + assert_screen 'cockpit_updates_auto_on'; + +} + +sub test_flags { + return { always_rolllback => 1 }; +} + +1; + +# vim: set sw=4 et: diff --git a/tests/server_cockpit_updates.pm b/tests/server_cockpit_updates.pm new file mode 100644 index 0000000..5e23b7e --- /dev/null +++ b/tests/server_cockpit_updates.pm @@ -0,0 +1,106 @@ +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: