Skip to content

Commit

Permalink
Fix staging and adjust tests for new welcome screen
Browse files Browse the repository at this point in the history
For staging we don't want to add all modules, as we do in
openQA Functional. This change allows to define short names of
modules to be added. E.g. ALL_MODULES=base,serverapp
In case of value '1', behavior remains same.

Another change for staging contains product selection on welcome screen
and not on separate screen as it was before. It's relevant for staging Y
only at the moment, but we can enable it for production once change is there.
  • Loading branch information
Rodion Iafarov committed Sep 4, 2017
1 parent 2016544 commit 144fd11
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
1 change: 1 addition & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ requires 'XML::Writer';
requires 'XML::Simple';
requires 'IO::File';
requires 'List::Util';
requires 'LWP::Simple';

on 'test' => sub {
requires 'Code::DRY';
Expand Down
30 changes: 25 additions & 5 deletions products/sle/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use needle;
use utils qw(is_hyperv_in_gui sle_version_at_least);
use File::Find;
use File::Basename;
use LWP::Simple 'head';

BEGIN {
unshift @INC, dirname(__FILE__) . '/../../lib';
Expand Down Expand Up @@ -287,7 +288,13 @@ if (get_var('DEV_IMAGE')) {

# This is workaround setting which will be removed once SCC add repos and allows adding modules
# TODO: remove when not used anymore
if (get_var('ALL_MODULES') && sle_version_at_least('15')) {
if (my $allmodules = get_var('ALL_MODULES') && sle_version_at_least('15')) {
#default to all modules if set to 1
my @modules = qw(base sdk desktop legacy script serverapp);
# If ALL_MODULES contains a list fo modules, add only them
if ($allmodules =~ /([[:alpha:]],?)+/) {
@modules = split(/,/, $allmodules);
}
my $arch = get_required_var("ARCH");
my $build = get_required_var("BUILD");
my $version = get_required_var("VERSION");
Expand All @@ -303,10 +310,23 @@ if (get_var('ALL_MODULES') && sle_version_at_least('15')) {
);
my $addonurl;

while (my ($short_name, $full_name) = each %modules) {
$addonurl .= "$short_name,";
my $module_repo_name = get_var("REPO_SLE${version}_MODULE_" . uc $full_name, "SLE-$version-Module-$full_name-POOL-$arch-Build$build-Media1/");
set_var('ADDONURL_' . uc $short_name, "$utils::OPENQA_FTP_URL/$module_repo_name");
for my $short_name (@modules) {
my $full_name = $modules{$short_name};
my $repo_name = uc $full_name;
# Replace dashes with underscore symbols
$repo_name =~ s/-/_/;
my $prefix = "SLE-$version";
# Add staging prefix
if (is_staging()) {
$prefix .= "-Staging:" . get_var("STAGING");
}
my $module_repo_name = get_var("REPO_SLE${version}_MODULE_${repo_name}", "$prefix-Module-$full_name-POOL-$arch-Build$build-Media1");
my $url = "$utils::OPENQA_FTP_URL/$module_repo_name";
# Verify if url exists before adding
if (head($url)) {
set_var('ADDONURL_' . uc $short_name, "$utils::OPENQA_FTP_URL/$module_repo_name");
$addonurl .= "$short_name,";
}
}
#remove last comma from ADDONURL setting value
$addonurl =~ s/,$//;
Expand Down
17 changes: 14 additions & 3 deletions tests/installation/welcome.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,20 @@ sub run {
mouse_hide;
wait_still_screen(3);

# license+lang
# On sle 15 license is on different screen
if (!sle_version_at_least('15') || is_staging()) {
# license+lang +product (on sle15)
# On sle 15 license is on different screen, here select the product
if (sle_version_at_least('15') && check_var('STAGING', 'Y')) {
assert_screen('select-product');
my %hotkey = (
sles => 'u',
sled => 'i',
leanos => 's'
);
my $product = get_required_var('SLE_PRODUCT');
send_key 'alt-' . $hotkey{$product};
assert_screen('select-product-' . $product);
}
else {
$self->verify_license_has_to_be_accepted;
}

Expand Down

0 comments on commit 144fd11

Please sign in to comment.