Skip to content

Commit

Permalink
Test SLED regcodes with or without wsl_gui
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-herranz committed Nov 7, 2022
1 parent c083c2c commit 24220ae
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
39 changes: 32 additions & 7 deletions tests/wsl/firstrun.pm
Expand Up @@ -60,8 +60,15 @@ sub license {

if (is_sle) {
# license warning
assert_screen 'wsl-license-not-accepted';
send_key 'ret';
assert_screen(['wsl-license-not-accepted', 'wsl-sled-license-not-accepted']);
if (match_has_tag 'wsl-license-not-accepted') {
send_key 'ret';
}
else {
# When activating SLED, license agreement for workstation module appears,
# and this time the popup shows Yes or No options
send_key 'alt-n';
}
# Accept license
assert_screen 'wsl-license';
send_key 'alt-a';
Expand Down Expand Up @@ -93,6 +100,22 @@ sub register_via_scc {
send_key 'alt-n';
}

sub wsl_gui_pattern {
assert_screen 'wsl-gui-pattern';
if (is_sut_reg) {
# Select product SLED if SLE_PRODUCT var is provided
send_key_until_needlematch('wsl_sled_install', 'alt-u') if (check_var('SLE_PRODUCT', 'sled'));
# Install wsl_gui pattern if WSL_GUI var is provided
send_key_until_needlematch('wsl_gui-pattern-install', 'alt-i') if (get_var('WSL_GUI'));
}
send_key 'alt-n';
}

sub trust_nvidia_gpg_keys {
assert_screen 'trust_nvidia_gpg_keys', timeout => 300;
send_key 'alt-t';
}

sub run {
# WSL installation is in progress
assert_screen [qw(yast2-wsl-firstboot-welcome wsl-installing-prompt)], 480;
Expand All @@ -108,13 +131,15 @@ sub run {
assert_screen 'local-user-credentials';
enter_user_details([$realname, undef, $password, $password]);
send_key 'alt-n';
# wsl-gui pattern installation
if (is_sle('>15-SP3')) {
assert_screen 'wsl-gui-pattern';
send_key 'alt-n';
}
# wsl-gui pattern installation (only in SLE15-SP4 by now)
wsl_gui_pattern if (is_sle('=15-SP4'));
# Registration
is_sle && register_via_scc();
# SLED Workstation license agreement and trust nVidia GPG keys
if (check_var('SLE_PRODUCT', 'sled')) {
license;
trust_nvidia_gpg_keys;
}
# And done!
assert_screen 'wsl-installation-completed', 240;
send_key 'alt-f';
Expand Down
6 changes: 5 additions & 1 deletion tests/wsl/wsl_cmd_check.pm
Expand Up @@ -7,7 +7,7 @@
# Maintainer: qa-c <qa-c@suse.de>

use Mojo::Base qw(windowsbasetest);
use testapi qw(assert_and_click enter_cmd get_var);
use testapi qw(assert_and_click enter_cmd get_var check_var);
use version_utils qw(is_sle is_opensuse);
use wsl qw(is_sut_reg);

Expand All @@ -34,6 +34,10 @@ sub run {
$self->run_in_powershell(cmd => 'wsl -u root zypper -q -n in python3', timeout => 120);
$self->run_in_powershell(cmd => q{wsl python3 -c "print('Hello from Python living in WSL')"});
}
# Check if wsl_gui has been installed during the YaST2 firstboot
$self->run_in_powershell(cmd => 'wsl /bin/bash -c "zypper -q se -i -t pattern wsl"') if (get_var('WSL_GUI'));
# Check if SLED has been enabled during the YaST2 firstboot
$self->run_in_powershell(cmd => 'wsl /bin/bash -c "cat /etc/os-release | grep -i desktop"') if (check_var('SLE_PRODUCT', 'sled'));
$self->run_in_powershell(cmd => 'wsl --shutdown', timeout => 60);
$self->run_in_powershell(cmd => 'wsl --list --verbose', timeout => 60);
}
Expand Down

0 comments on commit 24220ae

Please sign in to comment.