Skip to content

Commit

Permalink
Merge pull request os-autoinst#20164 from linguini-dev/bugfix/disable…
Browse files Browse the repository at this point in the history
…-skopeo-on-docker

Make Skopeo tests work with either Docker or Podman runtimes
  • Loading branch information
ricardobranco777 authored Sep 13, 2024
2 parents 76b7520 + a71c446 commit f059221
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/main_containers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand Down
22 changes: 11 additions & 11 deletions tests/containers/skopeo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f059221

Please sign in to comment.