Skip to content

Commit

Permalink
Unify interactive installations in tests/yam/agama and its respective…
Browse files Browse the repository at this point in the history
… schedules
  • Loading branch information
openQA web UI committed Aug 24, 2023
1 parent 241c52f commit d22b19c
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 6 deletions.
8 changes: 8 additions & 0 deletions lib/Yam/agama/agama_base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ use Utils::Logging 'save_and_upload_log';
use utils 'ensure_serialdev_permissions';
use serial_terminal qw(select_serial_terminal);

our @EXPORT = qw(
set_password
)

sub pre_run_hook {
$testapi::password = 'linux';
}
Expand All @@ -33,6 +37,10 @@ sub post_run_hook {
ensure_serialdev_permissions;
}

sub set_password {
$testapi::password = 'nots3cr3t';
}

sub test_flags {
return {fatal => 1};
}
Expand Down
4 changes: 3 additions & 1 deletion schedule/yam/agama/agama_encrypted_lvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ name: agama_dolomite_encrypted_lvm
description: >
Playwright test on agama dolomite for installation with fully encrypted disk,
with LVM in use.
vars:
AGAMA_TEST: 'encrypted_lvm'
schedule:
- installation/bootloader_start
- yam/agama/patch_agama
- yam/agama/agama_encrypted_lvm
- yam/agama/agama
- installation/boot_encrypt
- installation/first_boot
- console/validate_encrypt
Expand Down
4 changes: 3 additions & 1 deletion schedule/yam/agama/agama_full_disk_encryption.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
name: agama_install_full_disk_encryption.yaml
description: >
Playwright test on agama
vars:
AGAMA_TEST: 'full-disk-encryption'
schedule:
- installation/bootloader_start
- yam/agama/patch_agama
- yam/agama/agama_full_disk_encryption
- yam/agama/agama
- installation/boot_encrypt
- installation/first_boot
- console/validate_encrypt
4 changes: 3 additions & 1 deletion schedule/yam/agama/agama_installation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
name: agama_installation
description: >
Playwright test on agama
vars:
AGAMA_TEST: 'take_screenshots'
schedule:
- installation/bootloader_start
- yam/agama/patch_agama
- yam/agama/agama_installation
- yam/agama/agama
4 changes: 3 additions & 1 deletion schedule/yam/agama/agama_lvm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
name: agama_lvm
description: >
Playwright use lvm test on agama
vars:
AGAMA_TEST: 'lvm'
schedule:
- installation/bootloader_start
- yam/agama/patch_agama
- yam/agama/agama_lvm
- yam/agama/agama
- console/validate_lvm
48 changes: 48 additions & 0 deletions tests/yam/agama/agama.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## Copyright 2023 SUSE LLC

Check failure on line 1 in tests/yam/agama/agama.pm

View workflow job for this annotation

GitHub Actions / CI: Running static tests with perl v5.32

File tests/yam/agama/agama.pm needs tidying
# SPDX-License-Identifier: GPL-2.0-or-later

# Summary: Run interactive installation with Agama,
# run playwright tests directly from the Live ISO.
# Maintainer: QE YaST and Migration (QE Yam) <qe-yam at suse de>

use base Yam::agama::agama_base;
use strict;
use warnings;

use testapi qw(
assert_screen
assert_script_run
select_console
get_required_var
upload_logs
match_has_tag
reset_consoles
get_var
);

sub run {
my $test = get_required_var('AGAMA_TEST');
my $cmd;
if ($test !~ /take_screenshots/) {
$cmd = 'PRODUCTNAME="' . get_required_var('AGAMA_PRODUCT') . '"';
} else {
$cmd = 'RUN_INSTALLATION=1';
}
assert_script_run($cmd . ' playwright test --trace on --project chromium --config /usr/share/e2e-agama-playwright tests/' . $test . '.spec.ts', timeout => 1200);

assert_script_run('reboot');
# For agama test, it is too short time to match the grub2, so we create
# a new needle to avoid too much needles loaded.
if (!get_var('ENCRYPT')) {
assert_screen('grub2-agama', 120);
my @tags = ("welcome-to", "login");
assert_screen(\@tags, 300);
reset_consoles;
}
}

sub post_fail_hook {
upload_logs("./test-results/agama/trace.zip");
}

1;
2 changes: 0 additions & 2 deletions tests/yam/agama/patch_agama.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ sub run {

my ($repo, $branch) = split /#/, get_required_var('YUPDATE_GIT');
assert_script_run("yupdate patch $repo $branch", timeout => 60);

select_console 'installation';
}

1;

0 comments on commit d22b19c

Please sign in to comment.