Skip to content

Commit

Permalink
Exclude pod validation for SLE<16
Browse files Browse the repository at this point in the history
  • Loading branch information
KuxaBeast committed Oct 30, 2024
1 parent 8978843 commit d8e3064
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions tests/containers/podman_quadlet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Mojo::Base qw(containers::basetest);
use testapi;
use serial_terminal qw(select_serial_terminal);
use version_utils qw(package_version_cmp);
use version_utils qw(package_version_cmp is_sle);
use Utils::Systemd qw(systemctl);
use JSON;

Expand Down Expand Up @@ -48,19 +48,19 @@ my @systemd_container = ("$quadlet_dir/$unit_name.container", <<_EOF_);
Description=Test nginx container
After=network.target
[Container]
Image=$unit_name.build
Volume=$unit_name.volume:/opt
Pod=$unit_name.pod
[Service]
Restart=always
# Extend Timeout to allow time to pull the image
TimeoutStartSec=120
[Install]
WantedBy=multi-user.target
[Container]
Image=$unit_name.build
Volume=$unit_name.volume:/opt
_EOF_
$systemd_container[1] .= "Pod=$unit_name.pod\n" unless is_sle("<16");

my @systemd_volume = ("$quadlet_dir/$unit_name.volume", <<_EOF_);
[Volume]
Expand All @@ -69,8 +69,12 @@ Group=root
Label=org.test.Key=TESTING
_EOF_

my @files = (\@systemd_build, \@containerfile, \@systemd_network, \@systemd_pod, \@systemd_container, \@systemd_volume);
my @units = map { "$unit_name$_.service" } ("", "-pod", "-build", "-network", "-volume");
my @files = (\@systemd_build, \@containerfile, \@systemd_network, \@systemd_container, \@systemd_volume);
my @units = map { "$unit_name$_.service" } ("", "-build", "-network", "-volume");
unless (is_sle("<16")) {
push @files, \@systemd_pod;
push @units, "$unit_name-pod.service";
}

sub check_unit_states {
my $expected = shift // 'generated';
Expand Down Expand Up @@ -118,7 +122,9 @@ sub run {
systemctl("start $unit_name.service");
check_unit_states();
systemctl("is-active $unit_name.service");
systemctl("is-active $unit_name-pod.service");
unless (is_sle("<16")) {
systemctl("is-active $unit_name-pod.service");
}
systemctl("is-active $unit_name-volume.service");
systemctl("is-active $unit_name-network.service");

Expand All @@ -128,7 +134,9 @@ sub run {

# container checks
validate_script_output('podman container list --noheading', qr/systemd-$unit_name/);
validate_script_output('podman pod list -n', qr/systemd-$unit_name/);
unless (is_sle("<16")) {
validate_script_output('podman pod list -n', qr/systemd-$unit_name/);
}
validate_script_output('podman volume list -n', qr/systemd-$unit_name/);

# disable service & remove units
Expand Down

0 comments on commit d8e3064

Please sign in to comment.