Skip to content

Commit 3fe38c3

Browse files
Merge pull request os-autoinst#24797 from ricardobranco777/xfailversion
Use package version instead of product version for xfails
2 parents 19b1d13 + 625234b commit 3fe38c3

File tree

17 files changed

+57
-29
lines changed

17 files changed

+57
-29
lines changed

lib/containers/bats.pm

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ our @EXPORT = qw(
4040
install_gotestsum
4141
install_ncat
4242
mount_tmp_vartmp
43+
numeric_version
4344
patch_junit
4445
patch_sources
4546
run_command
@@ -623,17 +624,24 @@ sub bats_tests {
623624
return ($ret);
624625
}
625626

627+
sub numeric_version {
628+
my $version = shift;
629+
630+
# Sometimes version strings have a leading "v" or a trailing "-ce"
631+
# Strip leading & trailing non-digits from version
632+
$version =~ s/^\D+//;
633+
$version =~ s/\D+$//;
634+
return $version;
635+
}
636+
626637
sub patch_sources {
627638
my ($package, $branch, $tests_dir) = @_;
628639

629640
my $text = script_output("curl " . data_url("containers/patches.yaml"), quiet => 1);
630641
my $yaml = YAML::PP->new()->load_string($text);
631642
my $patches = $yaml->{$package} // {};
632643

633-
# Strip leading & trailing non-digits from version
634-
my $version = $branch;
635-
$version =~ s/^\D+//;
636-
$version =~ s/\D+$//;
644+
my $version = numeric_version($branch);
637645

638646
my @patches = split(/\s+/, get_var("GITHUB_PATCHES", ""));
639647
if (!@patches) {

tests/containers/bats/aardvark.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ use Mojo::Base 'containers::basetest';
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use containers::bats;
1516

1617
my $aardvark = "";
18+
my $version;
1719

1820
sub run_tests {
1921
my $netavark = script_output "rpm -ql netavark | grep podman/netavark";
@@ -27,8 +29,9 @@ sub run_tests {
2729

2830
my @xfails = ();
2931
push @xfails, (
32+
# Test fails on SLES 15 which uses aardvard-dns 1.12.x
3033
"100-basic-name-resolution.bats::basic container - dns itself on container with ipaddress v6",
31-
) if (is_sle("<16"));
34+
) if (version->parse(numeric_version($version)) < version->parse("1.14.0"));
3235

3336
return bats_tests($log_file, \%env, \@xfails, 800);
3437
}
@@ -47,8 +50,8 @@ sub run {
4750
record_info("aardvark-dns package version", script_output("rpm -q aardvark-dns"));
4851

4952
# Download aardvark sources
50-
my $aardvark_version = script_output "$aardvark --version | awk '{ print \$2 }'";
51-
patch_sources "aardvark-dns", "v$aardvark_version", "test";
53+
$version = script_output "$aardvark --version | awk '{ print \$2 }'";
54+
patch_sources "aardvark-dns", "v$version", "test";
5255

5356
return 0 if check_var("BATS_IGNORE", "all");
5457
my $errors = run_tests;

tests/containers/bats/buildah.pm

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ use Mojo::Base 'containers::basetest';
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use Utils::Architectures;
1516
use containers::bats;
1617

17-
my $buildah_version = "";
18+
my $version = "";
1819

1920
sub run_tests {
2021
my %params = @_;
@@ -37,16 +38,16 @@ sub run_tests {
3738
my @xfails = ();
3839
push @xfails, (
3940
"add.bats::add https retry ca"
40-
) if (is_sle(">=16"));
41+
) if (version->parse(numeric_version($version)) <= version->parse("1.39.5"));
4142
push @xfails, (
4243
"bud.bats::bud with --cgroup-parent",
43-
) if (is_sle && !$rootless);
44+
) if (version->parse(numeric_version($version)) <= version->parse("1.39.5") && !$rootless);
4445
push @xfails, (
4546
"bud.bats::bud-git-context",
4647
"bud.bats::bud-git-context-subdirectory",
4748
"bud.bats::bud using gitrepo and branch",
4849
"run.bats::Check if containers run with correct open files/processes limits",
49-
) if (is_sle("<16") && !$rootless);
50+
) if (version->parse(numeric_version($version)) < version->parse("1.39.5") && !$rootless);
5051
push @xfails, (
5152
"bud.bats::bud-multiple-platform-no-partial-manifest-list",
5253
) if (is_sle("<15-SP6"));
@@ -97,7 +98,7 @@ sub test_conformance {
9798
run_command "gotestsum --junitfile conformance.xml --format standard-verbose -- ./tests/conformance/... &> conformance.txt", no_assert => 1, timeout => 1200;
9899
upload_logs "conformance.txt";
99100
die "Testsuite failed" if script_run("test -s conformance.xml");
100-
patch_junit "buildah", $buildah_version, "conformance.xml";
101+
patch_junit "buildah", $version, "conformance.xml";
101102
parse_extra_log(XUnit => "conformance.xml");
102103
}
103104

@@ -123,8 +124,8 @@ sub run {
123124
record_info("buildah rootless", script_output("buildah info"));
124125

125126
# Download buildah sources
126-
$buildah_version = script_output "buildah --version | awk '{ print \$3 }'";
127-
patch_sources "buildah", "v$buildah_version", "tests";
127+
$version = script_output "buildah --version | awk '{ print \$3 }'";
128+
patch_sources "buildah", "v$version", "tests";
128129

129130
# Patch mkdir to always use -p
130131
run_command "sed -i 's/ mkdir /& -p /' tests/*.bats tests/helpers.bash";

tests/containers/bats/conmon.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use Mojo::Base 'containers::basetest';
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use containers::bats;
1516

1617
sub run_tests {

tests/containers/bats/netavark.pm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ use Mojo::Base 'containers::basetest';
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use containers::bats;
1516

1617
my $netavark;
18+
my $version;
1719

1820
sub run_tests {
1921
my %env = (
@@ -24,8 +26,9 @@ sub run_tests {
2426

2527
my @xfails = ();
2628
push @xfails, (
29+
# Test fails on SLES 15 which uses netavark 1.12.x
2730
"250-bridge-nftables.bats",
28-
) if (is_sle("<16"));
31+
) if (version->parse(numeric_version($version)) < version->parse("1.14.0"));
2932

3033
return bats_tests($log_file, \%env, \@xfails, 1200);
3134
}
@@ -46,8 +49,8 @@ sub run {
4649
record_info("netavark package version", script_output("rpm -q netavark"));
4750

4851
# Download netavark sources
49-
my $netavark_version = script_output "$netavark --version | awk '{ print \$2 }'";
50-
patch_sources "netavark", "v$netavark_version", "test";
52+
$version = script_output "$netavark --version | awk '{ print \$2 }'";
53+
patch_sources "netavark", "v$version", "test";
5154

5255
my $firewalld_backend = script_output "awk -F= '\$1 == \"FirewallBackend\" { print \$2 }' < /etc/firewalld/firewalld.conf";
5356
record_info("Firewalld backend", $firewalld_backend);

tests/containers/bats/podman.pm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ use Mojo::Base 'containers::basetest';
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use Utils::Architectures;
1516
use containers::bats;
1617

1718
my $oci_runtime = "";
19+
my $version;
1820

1921
sub run_tests {
2022
my %params = @_;
@@ -44,20 +46,20 @@ sub run_tests {
4446
push @xfails, (
4547
# These fail for user/local on Tumbleweed
4648
"252-quadlet.bats::quadlet kube - start error",
47-
) unless (is_sle);
49+
) if (version->parse(numeric_version($version)) >= version->parse("5.4.0"));
4850
}
4951
push @xfails, (
5052
# These sometimes fail for user on SLES 16.0 & Tumbleweed
5153
"505-networking-pasta.bats::TCP/IPv4 large transfer, tap",
5254
"505-networking-pasta.bats::IPv6 default address assignment",
53-
) unless (is_sle("<16"));
55+
) if (version->parse(numeric_version($version)) >= version->parse("5.4.0"));
5456
} else {
5557
if (!$remote) {
5658
push @xfails, (
5759
# These fail for root/local on SLES 16.0 & Tumbleweed
5860
# due to https://github.com/containers/podman/issues/27246
5961
"200-pod.bats::pod resource limits",
60-
) unless (is_sle("<16"));
62+
) if (version->parse(numeric_version($version)) >= version->parse("5.4.0"));
6163
}
6264
}
6365
push @xfails, (
@@ -106,8 +108,8 @@ sub run {
106108
record_info("podman rootless", script_output("podman info"));
107109

108110
# Download podman sources
109-
my $podman_version = script_output "podman --version | awk '{ print \$3 }'";
110-
patch_sources "podman", "v$podman_version", "test/system";
111+
$version = script_output "podman --version | awk '{ print \$3 }'";
112+
patch_sources "podman", "v$version", "test/system";
111113

112114
$oci_runtime = get_var("OCI_RUNTIME", script_output("podman info --format '{{ .Host.OCIRuntime.Name }}'"));
113115

tests/containers/bats/runc.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use Mojo::Base 'containers::basetest';
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use Utils::Architectures;
1516
use containers::bats;
1617

tests/containers/bats/skopeo.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use Utils::Architectures;
1414
use version_utils;
15+
use version;
1516
use containers::bats;
1617

1718
my $skopeo_version;

tests/containers/bats/umoci.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use Mojo::Base 'containers::basetest';
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use containers::bats;
1516

1617
sub run_tests {

tests/containers/containerd.pm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use Mojo::Base 'containers::basetest', -signatures;
1111
use testapi;
1212
use serial_terminal qw(select_serial_terminal);
1313
use version_utils;
14+
use version;
1415
use utils;
1516
use Utils::Architectures;
1617
use File::Basename;

0 commit comments

Comments
 (0)