From 3328b3e3bc07294581a9cca93c5d98c261f17612 Mon Sep 17 00:00:00 2001 From: Ricardo Branco Date: Wed, 19 Feb 2025 11:30:52 +0100 Subject: [PATCH] containers: Use SUSE repo for upstream tests on SLE --- tests/containers/buildah_integration.pm | 14 +++++++++----- tests/containers/podman_integration.pm | 14 +++++++++----- tests/containers/skopeo_integration.pm | 14 +++++++++----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/tests/containers/buildah_integration.pm b/tests/containers/buildah_integration.pm index 3755192fbd26..f54e6794d5e1 100644 --- a/tests/containers/buildah_integration.pm +++ b/tests/containers/buildah_integration.pm @@ -16,7 +16,6 @@ use containers::bats; use version_utils qw(is_sle); my $test_dir = "/var/tmp"; -my $buildah_version = ""; my $oci_runtime = ""; sub run_tests { @@ -79,9 +78,14 @@ sub run { assert_script_run "cd $test_dir"; # Download buildah sources - $buildah_version = script_output "buildah --version | awk '{ print \$3 }'"; - script_retry("curl -sL https://github.com/containers/buildah/archive/refs/tags/v$buildah_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); - assert_script_run "cd $test_dir/buildah-$buildah_version/"; + my $buildah_version = script_output "buildah --version | awk '{ print \$3 }'"; + if (is_sle) { + script_retry("curl -sL https://github.com/SUSE/buildah/archive/refs/heads/v$buildah_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); + assert_script_run "cd $test_dir/buildah-suse-v$buildah_version/"; + } else { + script_retry("curl -sL https://github.com/containers/buildah/archive/refs/tags/v$buildah_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); + assert_script_run "cd $test_dir/buildah-$buildah_version/"; + } # Patch mkdir to always use -p assert_script_run "sed -i 's/ mkdir /& -p /' tests/*.bats tests/helpers.bash"; @@ -102,7 +106,7 @@ sub run { sub cleanup() { assert_script_run "cd ~"; - script_run("rm -rf $test_dir/buildah-$buildah_version/"); + script_run("rm -rf $test_dir/buildah-*"); bats_post_hook; } diff --git a/tests/containers/podman_integration.pm b/tests/containers/podman_integration.pm index 1b9e0f4cf71c..22a418f80a1f 100644 --- a/tests/containers/podman_integration.pm +++ b/tests/containers/podman_integration.pm @@ -18,7 +18,6 @@ use Utils::Architectures qw(is_x86_64 is_aarch64); use containers::bats; my $test_dir = "/var/tmp"; -my $podman_version = ""; my $oci_runtime = ""; sub run_tests { @@ -106,9 +105,14 @@ sub run { assert_script_run "cd $test_dir"; # Download podman sources - $podman_version = get_podman_version(); - script_retry("curl -sL https://github.com/containers/podman/archive/refs/tags/v$podman_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); - assert_script_run("cd $test_dir/podman-$podman_version/"); + my $podman_version = get_podman_version(); + if (is_sle) { + script_retry("curl -sL https://github.com/SUSE/podman/archive/refs/heads/v$podman_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); + assert_script_run "cd $test_dir/podman-suse-v$podman_version/"; + } else { + script_retry("curl -sL https://github.com/containers/podman/archive/refs/tags/v$podman_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); + assert_script_run("cd $test_dir/podman-$podman_version/"); + } assert_script_run "sed -i 's/bats_opts=()/bats_opts=(--tap)/' hack/bats"; assert_script_run "sed -i 's/^PODMAN_RUNTIME=/&$oci_runtime/' test/system/helpers.bash"; assert_script_run "rm -f contrib/systemd/system/podman-kube@.service.in"; @@ -136,7 +140,7 @@ sub run { sub cleanup() { assert_script_run "cd ~"; - script_run("rm -rf $test_dir/podman-$podman_version/"); + script_run("rm -rf $test_dir/podman-*"); bats_post_hook; } diff --git a/tests/containers/skopeo_integration.pm b/tests/containers/skopeo_integration.pm index 26139341029b..f16e3e49e2e0 100644 --- a/tests/containers/skopeo_integration.pm +++ b/tests/containers/skopeo_integration.pm @@ -17,7 +17,6 @@ use containers::bats; use version_utils qw(is_sle is_sle_micro); my $test_dir = "/var/tmp"; -my $skopeo_version = ""; sub run_tests { my %params = @_; @@ -74,9 +73,14 @@ sub run { assert_script_run "cd $test_dir"; # Download skopeo sources - $skopeo_version = script_output "skopeo --version | awk '{ print \$3 }'"; - script_retry("curl -sL https://github.com/containers/skopeo/archive/refs/tags/v$skopeo_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); - assert_script_run "cd $test_dir/skopeo-$skopeo_version/"; + my $skopeo_version = script_output "skopeo --version | awk '{ print \$3 }'"; + if (is_sle) { + script_retry("curl -sL https://github.com/SUSE/skopeo/archive/refs/heads/v$skopeo_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); + assert_script_run "cd $test_dir/skopeo-suse-v$skopeo_version/"; + } else { + script_retry("curl -sL https://github.com/containers/skopeo/archive/refs/tags/v$skopeo_version.tar.gz | tar -zxf -", retry => 5, delay => 60, timeout => 300); + assert_script_run "cd $test_dir/skopeo-$skopeo_version/"; + } my $errors = run_tests(rootless => 1, skip_tests => get_var('SKOPEO_BATS_SKIP_USER', '')); @@ -90,7 +94,7 @@ sub run { sub cleanup() { assert_script_run "cd ~"; - script_run("rm -rf $test_dir/skopeo-$skopeo_version/"); + script_run("rm -rf $test_dir/skopeo-*"); bats_post_hook; }