Skip to content

Commit

Permalink
Improve Agama unattended installation
Browse files Browse the repository at this point in the history
  • Loading branch information
jknphy committed Nov 7, 2024
1 parent 0256e00 commit 2448087
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 35 deletions.
2 changes: 1 addition & 1 deletion lib/Yam/Agama/Pom/AgamaUpAndRunningBasePage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sub new {
my ($class, $args) = @_;
return bless {
tag_array_ref_any_first_screen_shown => [],
timeout_expect_is_shown => $args->{timeout_expect_is_shown} // 90
timeout_expect_is_shown => $args->{timeout_expect_is_shown} // 120
}, $class;
}

Expand Down
29 changes: 9 additions & 20 deletions lib/Yam/Agama/Pom/RebootPage.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,15 @@ sub new {
}

sub expect_is_shown {
my ($self, %args) = @_;
my $timeout = $args{timeout};
if ($timeout <= 1200) {
assert_screen($self->{tag_installation_complete}, ${timeout});
} else {
my $mouse_x = 1;
while (1) {
die "timeout ($timeout) hit on during installation" if $timeout <= 0;
if (check_screen $self->{tag_installation_complete}, 30) {
last;
} else {
$timeout -= 30;
diag("left total timeout: $timeout");
diag('installation not finished, move mouse around a bit to keep screen unlocked');
mouse_set(($mouse_x + 10) % 1024, 1);
sleep 1;
mouse_set($mouse_x, 1);
next;
}
}
my $self = shift;
my $timeout = 2400;

while ($timeout > 0) {
my $ret = check_screen($self->{tag_installation_complete}, 30);
$timeout -= 30;
diag("left total await_install timeout: $timeout");
last if $ret;
die "timeout ($timeout) hit awaiting installation to be finished" if $timeout <= 0;
}
}

Expand Down
6 changes: 1 addition & 5 deletions lib/Yam/Agama/agama_base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ use testapi;
use Utils::Logging 'save_and_upload_log';

sub post_fail_hook {
select_console 'root-console';
upload_agama_logs();
upload_system_logs();
upload_browser_automation_dumps();
}

sub upload_agama_logs {
select_console 'root-console';
save_and_upload_log('agama logs store', "/tmp/agama-logs.tar.gz");
}

sub upload_system_logs {
save_and_upload_log('journalctl -b > /tmp/journal.log', "/tmp/journal.log");
}

Expand Down
5 changes: 2 additions & 3 deletions tests/yam/agama/agama.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ sub pre_run_hook {
}

sub run {
my $self = shift;
my $test = get_required_var('AGAMA_TEST');
my $test_options = get_required_var('AGAMA_TEST_OPTIONS');
my $reboot_page = $testapi::distri->get_reboot();
Expand All @@ -38,9 +39,7 @@ sub run {
$test_options, timeout => 1200);
script_run("dmesg --console-on");

Yam::Agama::agama_base::upload_agama_logs();
Yam::Agama::agama_base::upload_system_logs();

$self->upload_agama_logs();
$reboot_page->reboot();
}

Expand Down
9 changes: 3 additions & 6 deletions tests/yam/agama/agama_auto.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ use warnings;
use testapi;

sub run {
my $self = shift;
my $reboot_page = $testapi::distri->get_reboot();

$reboot_page->expect_is_shown(timeout => ((get_var('DESKTOP') eq 'gnome') ? 2400 : 1200));

select_console 'root-console';
Yam::Agama::agama_base::upload_agama_logs();
Yam::Agama::agama_base::upload_system_logs();

$reboot_page->expect_is_shown();
$self->upload_agama_logs();
$reboot_page->reboot();
}

Expand Down

0 comments on commit 2448087

Please sign in to comment.