Skip to content

Commit

Permalink
BCI: LTSS containers testing on LTSS hosts only
Browse files Browse the repository at this point in the history
  • Loading branch information
m-dati committed Jan 31, 2025
1 parent c52a53f commit 4c374dd
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/containers/bci_prepare.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use containers::common;
use testapi;
use serial_terminal 'select_serial_terminal';


sub packages_to_install {
my ($version, $sp, $host_distri) = @_;
my $arch = get_required_var('ARCH');
Expand Down Expand Up @@ -81,6 +80,26 @@ sub activate_virtual_env {
assert_script_run('source bci/bin/activate');
}

sub check_ltss_container {
my ($host_dist, $host_vers, $sp, $cont_vers, $cont_image) = @_;
# work with all inputs
return unless ($host_vers && $host_dist && $sp && $cont_vers && $cont_image);
# skip non-ltss
return if ("$host_vers-$sp" =~ m/^15-[67]/ || $cont_image !~ /ltss/i);
# check version match
my $hdd = get_var('HDD_1');
record_info("LTSS host", $hdd);
die "OUT SCOPE: LTSS containers $cont_vers on $host_dist $host_vers host."
unless ($host_dist =~ /^sle/ && $host_vers =~ /^1[25]/ && $host_vers eq substr($cont_vers, 0, 2));
# check LTSS activation
my $status = q(SUSEConnect -s | jq -Mr '.[] | select(.identifier == "SLES-LTSS") | .subscription_status');
die "LTSS activation missing on host $hdd"
unless (script_output($status) =~ /ACTIVE/);
# all checks ok:run bci
record_info("BCI test ok", "LTSS host testing BCI " . $cont_image);
return 1;
}

sub run {
select_serial_terminal;

Expand Down Expand Up @@ -138,6 +157,8 @@ sub run {
}

return if (get_var('HELM_CONFIG') && !($host_distri == "sles" && $version == 15 && $sp >= 3));
# check LTSS activation on host
check_ltss_container($host_distri, $version, $sp, get_var('VERSION'), get_var('CONTAINER_IMAGE_TO_TEST'));

# For BCI tests using podman, buildah package is also needed
install_buildah_when_needed($host_distri) if ($engines =~ /podman/);
Expand Down

0 comments on commit 4c374dd

Please sign in to comment.