Skip to content

Commit

Permalink
Merge pull request #20126 from lkocman/agama_logs
Browse files Browse the repository at this point in the history
Upload agama-logs in agama.pm
  • Loading branch information
lkocman authored Sep 6, 2024
2 parents 3ddac30 + f355645 commit 9fe1c26
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 17 deletions.
1 change: 1 addition & 0 deletions lib/bootloader_setup.pm
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ sub bootmenu_default_params {
# agama.install_url supports comma separated list if more repos are needed ...
push @params, "agama.install_url=$host/assets/repo/$repo";
}
push @params, "live.password=$testapi::password";
}
else {
# On JeOS and MicroOS we don't have YaST installer.
Expand Down
1 change: 1 addition & 0 deletions lib/utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,7 @@ the session.

sub get_x11_console_tty {
my $new_sddm = (!is_sle('<15-SP6') && !is_leap('<15.6')) || is_krypton_argon;
# Agama uses tty7 for graphical install
if (check_var('DESKTOP', 'kde') || check_var('DESKTOP', 'lxqt')) {
return $new_sddm ? 2 : 7;
}
Expand Down
65 changes: 48 additions & 17 deletions tests/installation/agama.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
# Copyright 2024 SUSE LLC
# SPDX-License-Identifier: FSFAP

# Summary: Installation of Leap or Tumblweed with Agama
# Summary: Installation of Leap or Tumbleweed with Agama
# https://github.com/openSUSE/agama/

# Setting agama live media root password
# https://github.com/openSUSE/agama/blob/master/doc/live_iso.md#the-access-password
# Maintainer: Maintainer: Lubos Kocmman <[email protected]>,
# Maintainer: Lubos Kocman <[email protected]>,

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';

# Borrowed from grub2_tests.pm
sub edit_cmdline {
Expand All @@ -26,8 +28,7 @@ sub edit_cmdline {
send_key 'end';
}

sub agama_set_root_password_dialog
{
sub agama_set_root_password_dialog {
wait_still_screen 5;

type_password();
Expand All @@ -40,8 +41,7 @@ sub agama_set_root_password_dialog
send_key 'ret';
}

sub agama_define_user_screen
{
sub agama_define_user_screen {
wait_still_screen 5;

# We need to click in the middle of the screen or similar
Expand All @@ -57,7 +57,7 @@ sub agama_define_user_screen

# Username
send_key 'tab';
type_string 'bernhard';
type_string $testapi::username;
wait_still_screen 5;

# Password - we have to send two tabs as there is a button to show typed password
Expand All @@ -84,9 +84,21 @@ sub agama_define_user_screen
send_key 'ret';
}

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-inst-welcome-product-list');

if (is_leap('>=16.0')) {
Expand All @@ -102,18 +114,18 @@ sub run {

# It seems that in lower resolutions agama hides list of tabs
# so we have to click on the top button to display them
# Good thing is that tabs get hiden automatically again
# Good thing is that tabs get hidden automatically again
# after you click one of the tabs
assert_and_click('agama-show-tabs');

assert_and_click('agama-users-tab');
assert_and_click('agama-set-root-password');
agama_set_root_password_dialog;
agama_set_root_password_dialog();


# Define user and set autologin on
assert_and_click('agama-define-user-button');
agama_define_user_screen;
agama_define_user_screen();

# Show tabs again
assert_and_click('agama-show-tabs');
Expand All @@ -139,7 +151,7 @@ sub run {
# Normally it's on the side
wait_still_screen 5;

# Ctrd+down takes you to bottom of the page,
# Ctrl+down takes you to bottom of the page,
# however, you need to click on the page first
mouse_set(600, 600);
mouse_click;
Expand All @@ -153,9 +165,9 @@ sub run {
# We're using wrong repo for testing
# BUG tracker: https://github.com/openSUSE/agama/issues/1474
# copied from await_install.pm
my $timeout = 2400;
my $timeout = 2400; # 40 minutes timeout for installation process
while (1) {
die "timeout ($timeout) hit on during await_install" if $timeout <= 0;
die "timeout ($timeout) hit during await_install" if $timeout <= 0;
my $ret = check_screen 'agama-install-in-progress', 30;
sleep 30;
$timeout -= 30;
Expand All @@ -166,12 +178,31 @@ sub run {
}
}


# installation done
# TODO fetch agama logs after install see https://github.com/openSUSE/agama/issues/1447
assert_screen('agama-congratulations');
console('installation')->set_tty(get_agama_install_console_tty());
upload_agama_logs();
select_console('installation', await_console => 0);
assert_and_click('agama-reboot-after-install');

}

=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;

0 comments on commit 9fe1c26

Please sign in to comment.