Skip to content

Commit ba52fbd

Browse files
Add aggregate repos to ibsm modules
1 parent 1c079b9 commit ba52fbd

3 files changed

Lines changed: 28 additions & 7 deletions

File tree

lib/sles4sap.pm

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use Mojo::Base 'opensusebasetest';
1313
use strict;
1414
use warnings;
1515
use testapi;
16+
use bmwqemu ();
1617
use serial_terminal qw(select_serial_terminal);
1718
use utils;
1819
use hacluster qw(get_hostname ha_export_logs pre_run_hook save_state wait_until_resources_started script_output_retry_check);
@@ -72,6 +73,7 @@ our @EXPORT = qw(
7273
load_ase_env
7374
upload_ase_logs
7475
modify_selinux_setenforce
76+
get_test_repos
7577
);
7678

7779
=head1 SYNOPSIS
@@ -1452,6 +1454,28 @@ sub modify_selinux_setenforce {
14521454
}
14531455
}
14541456

1457+
=head2 get_test_repos
1458+
1459+
Constructs an array of repos to be added to SUTs.
1460+
1461+
=cut
1462+
1463+
sub get_test_repos {
1464+
# In Incidents there is INCIDENT_REPO instead of MAINT_TEST_REPO
1465+
# Those two variables contain list of repositories separated by comma
1466+
set_var('MAINT_TEST_REPO', get_var('INCIDENT_REPO')) if get_var('INCIDENT_REPO');
1467+
my @repos = split(/,/, get_var('MAINT_TEST_REPO'));
1468+
# Add aggregate repos to @repos, if they are provided
1469+
# Test repos are expected to end in '_TEST_REPOS'
1470+
my @test_repos = grep { /_TEST_REPOS$/ } keys %bmwqemu::vars;
1471+
for my $repo (@test_repos) {
1472+
if (my $value = get_var($repo)) {
1473+
push @repos, split(/,/, $value);
1474+
}
1475+
}
1476+
return @repos;
1477+
}
1478+
14551479
sub post_run_hook {
14561480
my ($self) = @_;
14571481

tests/publiccloud/validate_repos.pm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use warnings;
1313
use testapi;
1414
use strict;
1515
use utils;
16+
use sles4sap;
1617
use publiccloud::ssh_interactive "select_host_console";
1718
use publiccloud::utils "validate_repo";
1819

@@ -25,10 +26,7 @@ sub run {
2526
record_info('Skip validation', 'Skipping maintenance update validation (triggered by setting)');
2627
return;
2728
} else {
28-
# In Incidents there is INCIDENT_REPO instead of MAINT_TEST_REPO
29-
# Those two variables contain list of repositories separated by comma
30-
set_var('MAINT_TEST_REPO', get_var('INCIDENT_REPO')) unless get_var('MAINT_TEST_REPO');
31-
my @repos = split(/,/, get_var('MAINT_TEST_REPO'));
29+
my @repos = sles4sap::get_test_repos();
3230
# Failsafe: Fail if there are no test repositories, otherwise we have the wrong template link
3331
my $count = scalar @repos;
3432
my $check_empty_repos = get_var('PUBLIC_CLOUD_IGNORE_EMPTY_REPO', 0) == 0;

tests/sles4sap/publiccloud/cluster_add_repos.pm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use strict;
88
use warnings;
99
use base 'sles4sap_publiccloud_basetest';
1010
use sles4sap_publiccloud;
11+
use sles4sap;
1112
use testapi;
1213

1314
sub test_flags {
@@ -17,9 +18,7 @@ sub test_flags {
1718
sub run {
1819
my ($self, $run_args) = @_;
1920
$self->import_context($run_args);
20-
21-
set_var('MAINT_TEST_REPO', get_var('INCIDENT_REPO')) if get_var('INCIDENT_REPO');
22-
my @repos = split(/,/, get_var('MAINT_TEST_REPO'));
21+
my @repos = sles4sap::get_test_repos();
2322
my $count = 0;
2423
my @zypper_cmd;
2524

0 commit comments

Comments
 (0)