From a71c4461066a92a832deb0fcf08bbb14324e4564 Mon Sep 17 00:00:00 2001 From: linguini-dev Date: Wed, 11 Sep 2024 11:25:52 +0300 Subject: [PATCH] Runs Skopeo test on Docker and Podman separately --- lib/main_containers.pm | 4 ++-- tests/containers/skopeo.pm | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/main_containers.pm b/lib/main_containers.pm index 950fa81a637d..85cf202572f5 100644 --- a/lib/main_containers.pm +++ b/lib/main_containers.pm @@ -142,7 +142,7 @@ sub load_host_tests_podman { loadtest 'containers/podman_netavark' unless (is_staging || is_sle("<15-sp3") || is_ppc64le); # Buildah is not available in SLE Micro, MicroOS and staging projects load_buildah_tests($run_args) unless (is_sle('<15') || is_sle_micro || is_microos || is_leap_micro || is_staging); - loadtest 'containers/skopeo' unless (is_sle('<15') || is_sle_micro('<5.5')); + loadtest('containers/skopeo', run_args => $run_args, name => $run_args->{runtime} . "_skopeo") unless (is_sle('<15') || is_sle_micro('<5.5')); loadtest 'containers/podman_quadlet' if is_tumbleweed; # https://github.com/containers/podman/issues/5732#issuecomment-610222293 # exclude rootless podman on public cloud because of cgroups2 special settings @@ -183,7 +183,7 @@ sub load_host_tests_docker { loadtest 'containers/buildx'; loadtest 'containers/rootless_docker'; } - loadtest('containers/skopeo') unless (is_sle('<15') || is_sle_micro('<5.5')); + loadtest('containers/skopeo', run_args => $run_args, name => $run_args->{runtime} . "_skopeo") unless (is_sle('<15') || is_sle_micro('<5.5')); load_volume_tests($run_args); load_compose_tests($run_args); loadtest('containers/seccomp', run_args => $run_args, name => $run_args->{runtime} . "_seccomp") unless is_sle('<15'); diff --git a/tests/containers/skopeo.pm b/tests/containers/skopeo.pm index b7373d997773..d4e99317ec32 100644 --- a/tests/containers/skopeo.pm +++ b/tests/containers/skopeo.pm @@ -17,12 +17,13 @@ use containers::common qw(install_packages); # Set a variable for test working directory my $workdir = '/tmp/test'; +my $runtime = ""; sub run { - my ($self, $args) = @_; - # Required packages my @packages = qw(skopeo jq); + my ($self, $args) = @_; + $runtime = $args->{runtime}; select_serial_terminal() unless is_vmware; # Select most suitable text console @@ -94,7 +95,7 @@ sub run { assert_script_run("diff -urN $dir1 $dir2", fail_message => 'Copied images are not identical.'); ######### Spin-up an instance of the latest Registry - assert_script_run("podman run --rm -d -p 5050:5000 --name skopeo-registry registry.suse.com/suse/registry:latest", + assert_script_run("$runtime run --rm -d -p 5050:5000 --name skopeo-registry registry.suse.com/suse/registry:latest", fail_message => "Failed to start local registry container"); ######### Pull the image into a our local repository @@ -126,24 +127,23 @@ sub run { } sub cleanup { + my $runtime = shift; record_info('Cleanup', 'Delete copied image directories'); script_run "rm -rf $workdir"; record_info('Cleanup Registry', 'Remove local image Registry'); - script_run "podman stop skopeo-registry"; - script_run "podman rm -vf skopeo-registry"; + script_run "$runtime stop skopeo-registry"; + script_run "$runtime rm -vf skopeo-registry"; } sub post_run_hook { - my $self = shift; - cleanup(); - $self->SUPER::post_run_hook; + my ($self) = @_; + cleanup($self->{runtime}); } sub post_fail_hook { - my $self = shift; - cleanup(); - $self->SUPER::post_fail_hook; + my ($self) = @_; + cleanup($self->{runtime}); } 1;