From 3ae719aa13b82fd3c5b874b72834f6ea69e784de Mon Sep 17 00:00:00 2001 From: Lubos Kocman Date: Tue, 10 Sep 2024 13:28:04 +0200 Subject: [PATCH] Split actions at the Agama reboot screen from rest * agama contains now installation until the congrats screne * agama_reboot contains the rest * remove unused edit_grub function --- tests/installation/agama.pm | 26 ++-------- tests/installation/agama_reboot.pm | 78 ++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 23 deletions(-) create mode 100644 tests/installation/agama_reboot.pm diff --git a/tests/installation/agama.pm b/tests/installation/agama.pm index e1484d53dcf1..5e7b2f170f35 100644 --- a/tests/installation/agama.pm +++ b/tests/installation/agama.pm @@ -8,6 +8,9 @@ # Setting agama live media root password # https://github.com/openSUSE/agama/blob/master/doc/live_iso.md#the-access-password + +# This test suite handles basic installation of Leap and Tumbleweed with Agama +# Actions past install-screen with reboot button ara handled separately in agama_reboot.pm # Maintainer: Lubos Kocman , use strict; @@ -19,15 +22,6 @@ use utils; use Utils::Logging qw(export_healthcheck_basic); use x11utils 'ensure_unlocked_desktop'; -# Borrowed from grub2_tests.pm -sub edit_cmdline { - send_key 'e'; - my $jump_down = is_sle('<15-sp4') ? '12' : '8'; - send_key 'down' for (1 .. $jump_down); - send_key_until_needlematch 'grub2-edit-linux-line', 'down'; - send_key 'end'; -} - sub agama_set_root_password_dialog { wait_still_screen 5; @@ -183,20 +177,6 @@ sub run { last; } } - - assert_screen('agama-congratulations'); - console('installation')->set_tty(get_agama_install_console_tty()); - upload_agama_logs(); - select_console('installation', await_console => 0); - # make sure newly booted system does not expect we're still logged in console - reset_consoles(); - assert_and_click('agama-reboot-after-install'); - - # workaround for lack of disable bootloader timeout - # https://github.com/openSUSE/agama/issues/1594 - # simply send space until we hit grub2 - send_key_until_needlematch("bootloader-grub2", 'spc', 50, 3); - } =head2 post_fail_hook diff --git a/tests/installation/agama_reboot.pm b/tests/installation/agama_reboot.pm new file mode 100644 index 000000000000..548ad013866d --- /dev/null +++ b/tests/installation/agama_reboot.pm @@ -0,0 +1,78 @@ +# oSUSE's openQA tests +# +# Copyright 2024 SUSE LLC +# SPDX-License-Identifier: FSFAP + +# Summary: Installation of Leap or Tumbleweed with Agama +# https://github.com/openSUSE/agama/ + +# Exepcted to be executed right after agama.pm +# This test handles actions that happen once we see the reboot button after install +# 1) Switch from installer to console to Upload logs +# 2) Switch back to X11/Wayland and reset_console s +# so newly booted system does not think that we're still logged in console +# 3) workaround for no ability to disable grub timeout in agama +# https://github.com/openSUSE/agama/issues/1594 +# grub_test() is too slow to catch boot screen for us +# Maintainer: Lubos Kocman , + +use strict; +use warnings; +use base "installbasetest"; +use testapi; +use version_utils qw(is_leap is_sle); +use utils; +use Utils::Logging qw(export_healthcheck_basic); +use x11utils 'ensure_unlocked_desktop'; + +sub upload_agama_logs { + return if (get_var('NOLOGS')); + select_console("root-console"); + # stores logs in /tmp/agma-logs.tar.gz + script_run('agama logs store'); + upload_logs('/tmp/agama-logs.tar.gz'); +} + +sub get_agama_install_console_tty { + # get_x11_console_tty would otherwise autodetermine 2 + return 7; +} + +sub run { + my ($self) = @_; + + assert_screen('agama-congratulations'); + console('installation')->set_tty(get_agama_install_console_tty()); + upload_agama_logs(); + select_console('installation', await_console => 0); + # make sure newly booted system does not expect we're still logged in console + reset_consoles(); + assert_and_click('agama-reboot-after-install'); + + # workaround for lack of disable bootloader timeout + # https://github.com/openSUSE/agama/issues/1594 + # simply send space until we hit grub2 + send_key_until_needlematch("bootloader-grub2", 'spc', 50, 3); + +} + +=head2 post_fail_hook + + post_fail_hook(); + +When the test module fails, this method will be called. +It will try to fetch logs from agama. + +=cut + +sub post_fail_hook { + my ($self) = @_; + + return if (get_var('NOLOGS')); + + select_console("root-console"); + export_healthcheck_basic(); + upload_agama_logs(); +} + +1;