Skip to content

Commit 2f81f9b

Browse files
Use run_command
1 parent d67467b commit 2f81f9b

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

tests/containers/podman_e2e.pm

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,6 @@ use containers::bats;
1717

1818
my $oci_runtime;
1919

20-
sub install_git {
21-
# We need git 2.47.0+ to use `--ours` with `git apply -3`
22-
if (is_sle) {
23-
my $version = get_var("VERSION");
24-
if (is_sle('<16')) {
25-
$version =~ s/-/_/;
26-
$version = "SLE_$version";
27-
}
28-
assert_script_run "zypper addrepo https://download.opensuse.org/repositories/Kernel:/tools/$version/Kernel:tools.repo";
29-
}
30-
assert_script_run "zypper --gpg-auto-import-keys -n install --allow-vendor-change git-core", timeout => 300;
31-
}
32-
3320
sub setup {
3421
my @pkgs = qw(aardvark-dns apache2-utils buildah catatonit glibc-devel-static go1.24 gpg2 jq libgpgme-devel
3522
libseccomp-devel make netavark openssl podman podman-remote skopeo socat sudo systemd-container xfsprogs);
@@ -43,20 +30,20 @@ sub setup {
4330
record_info "info", script_output("podman info -f json");
4431

4532
# Workaround for https://bugzilla.opensuse.org/show_bug.cgi?id=1248988 - catatonit missing in /usr/libexec/podman/
46-
assert_script_run "cp /usr/bin/catatonit /usr/libexec/podman/catatonit";
33+
run_command "cp -f /usr/bin/catatonit /usr/libexec/podman/catatonit";
4734
# rootless user needed for these tests
48-
assert_script_run "useradd -m containers";
49-
assert_script_run "usermod --add-subuids 100000-165535 containers";
50-
assert_script_run "usermod --add-subgids 100000-165535 containers";
35+
run_command "useradd -m containers";
36+
run_command "usermod --add-subuids 100000-165535 containers";
37+
run_command "usermod --add-subgids 100000-165535 containers";
5138
# Make /run/secrets directory available on containers
52-
assert_script_run "echo /var/lib/empty:/run/secrets >> /etc/containers/mounts.conf";
39+
run_command "echo /var/lib/empty:/run/secrets >> /etc/containers/mounts.conf";
5340

5441
# Enable SSH
5542
my $algo = "ed25519";
5643
systemctl 'enable --now sshd';
57-
assert_script_run "ssh-keygen -t $algo -N '' -f ~/.ssh/id_$algo";
58-
assert_script_run "cat ~/.ssh/id_$algo.pub >> ~/.ssh/authorized_keys";
59-
assert_script_run "ssh-keyscan localhost 127.0.0.1 ::1 | tee -a ~/.ssh/known_hosts";
44+
run_command "ssh-keygen -t $algo -N '' -f ~/.ssh/id_$algo";
45+
run_command "cat ~/.ssh/id_$algo.pub >> ~/.ssh/authorized_keys";
46+
run_command "ssh-keyscan localhost 127.0.0.1 ::1 | tee -a ~/.ssh/known_hosts";
6047

6148
# Download podman sources
6249
my $version = script_output q(podman --version | awk '{ print $3 }');
@@ -75,9 +62,9 @@ sub setup {
7562
$branch = $repo;
7663
}
7764

78-
assert_script_run "cd ~";
79-
assert_script_run "git clone --branch $branch https://github.com/$github_org/podman", timeout => 300;
80-
assert_script_run "cd ~/podman";
65+
run_command "cd ~";
66+
run_command "git clone --branch $branch https://github.com/$github_org/podman", timeout => 300;
67+
run_command "cd ~/podman";
8168

8269
unless ($repo) {
8370
# - https://github.com/containers/podman/pull/26934 - test/e2e: fix 'block all syscalls' seccomp for runc
@@ -87,11 +74,11 @@ sub setup {
8774
my $url = "https://github.com/$github_org/podman/pull/$patch";
8875
record_info("patch", $url);
8976
assert_script_run "curl -O " . data_url("containers/patches/podman/$patch.patch");
90-
assert_script_run "git apply -3 --ours $patch.patch";
77+
run_command "git apply -3 --ours $patch.patch";
9178
}
9279
# This test fails with:
9380
# Command exited 125 as expected, but did not emit 'failed to connect: dial tcp: lookup '
94-
assert_script_run "rm -f test/e2e/image_scp_test.go";
81+
run_command "rm -f test/e2e/image_scp_test.go";
9582
}
9683
}
9784

@@ -113,7 +100,7 @@ sub run {
113100
my $env = join " ", map { "$_=$env{$_}" } sort keys %env;
114101

115102
foreach my $target (qw(localintegration remoteintegration)) {
116-
script_run "env $env make $target |& tee $target.txt", timeout => 1800;
103+
run_command "env $env make $target |& tee $target.txt || true", timeout => 1800;
117104
script_run qq{sed -ri '0,/name=/s/name="Libpod Suite"/name="$target"/' report.xml};
118105
script_run "mv -v report.xml $target.xml";
119106
parse_extra_log(XUnit => "$target.xml");

0 commit comments

Comments
 (0)