forked from containers/podman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
buildah bud tests: better handling of remote
When I first enabled buildah-bud tests under podman-remote (containers#9887), I got one aspect all wrong: I added a podman-remote() helper function to match the podman() one. Turns out it's never actually called, even when $PODMAN_BINARY=podman-remote, because functions/aliases don't work that way. The way it works is, those few cases in which bud.bats runs podman are not magically remapped to podman-remote, they use the podman() function. That's where we need to check if we're using podman-remote, and that's where we need to remove the registry-and-rootdir options. With this fix, we can reenable two previously-skipped bud tests. Signed-off-by: Ed Santiago <[email protected]>
- Loading branch information
1 parent
d319860
commit 56fae7d
Showing
2 changed files
with
19 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
From 0e31bb3a189ecd3e3fca36d16bb29b5162cb7d5c Mon Sep 17 00:00:00 2001 | ||
From e11d1f32577a8b0307789208c3a39b0ab2a026d8 Mon Sep 17 00:00:00 2001 | ||
From: Ed Santiago <[email protected]> | ||
Date: Thu, 6 Oct 2022 17:32:59 -0600 | ||
Subject: [PATCH] tweaks for running buildah tests under podman | ||
|
||
Signed-off-by: Ed Santiago <[email protected]> | ||
--- | ||
tests/helpers.bash | 70 ++++++++++++++++++++++++++++++++++++++++++++-- | ||
1 file changed, 67 insertions(+), 3 deletions(-) | ||
tests/helpers.bash | 73 +++++++++++++++++++++++++++++++++++++++++++--- | ||
1 file changed, 69 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/tests/helpers.bash b/tests/helpers.bash | ||
index aab3f72e..fe02a6f1 100644 | ||
index aab3f72e..6e3b0eb5 100644 | ||
--- a/tests/helpers.bash | ||
+++ b/tests/helpers.bash | ||
@@ -70,6 +70,23 @@ EOF | ||
|
@@ -49,18 +49,21 @@ index aab3f72e..fe02a6f1 100644 | |
# Workaround for #1991 - buildah + overlayfs leaks mount points. | ||
# Many tests leave behind /var/tmp/.../root/overlay and sub-mounts; | ||
# let's find those and clean them up, otherwise 'rm -rf' fails. | ||
@@ -205,6 +228,10 @@ function podman() { | ||
command ${PODMAN_BINARY:-podman} ${PODMAN_REGISTRY_OPTS} ${ROOTDIR_OPTS} "$@" | ||
@@ -202,7 +225,12 @@ function copy() { | ||
} | ||
|
||
function podman() { | ||
- command ${PODMAN_BINARY:-podman} ${PODMAN_REGISTRY_OPTS} ${ROOTDIR_OPTS} "$@" | ||
+ local cmd=${PODMAN_BINARY:-podman} | ||
+ local opts="${PODMAN_REGISTRY_OPTS} ${ROOTDIR_OPTS}" | ||
+ if [[ $cmd =~ remote ]]; then | ||
+ opts= | ||
+ fi | ||
+ command $cmd $opts "$@" | ||
} | ||
|
||
+function podman-remote() { | ||
+ command ${PODMAN_BINARY:-podman-remote} ${ROOTDIR_OPTS} "$@" | ||
+} | ||
+ | ||
# There are various scenarios where we would like to execute `tests` as rootless user, however certain commands like `buildah mount` | ||
# do not work in rootless session since a normal user cannot mount a filesystem unless they're in a user namespace along with its | ||
# own mount namespace. In order to run such specific commands from a rootless session we must perform `buildah unshare`. | ||
@@ -266,8 +293,36 @@ function run_buildah() { | ||
@@ -266,8 +294,36 @@ function run_buildah() { | ||
--retry) retry=3; shift;; # retry network flakes | ||
esac | ||
|
||
|
@@ -98,7 +101,7 @@ index aab3f72e..fe02a6f1 100644 | |
|
||
# If session is rootless and `buildah mount` is invoked, perform unshare, | ||
# since normal user cannot mount a filesystem unless they're in a user namespace along with its own mount namespace. | ||
@@ -281,8 +336,8 @@ function run_buildah() { | ||
@@ -281,8 +337,8 @@ function run_buildah() { | ||
retry=$(( retry - 1 )) | ||
|
||
# stdout is only emitted upon error; this echo is to help a debugger | ||
|
@@ -109,7 +112,7 @@ index aab3f72e..fe02a6f1 100644 | |
# without "quotes", multiple lines are glommed together into one | ||
if [ -n "$output" ]; then | ||
echo "$output" | ||
@@ -614,6 +669,15 @@ function skip_if_no_docker() { | ||
@@ -614,6 +670,15 @@ function skip_if_no_docker() { | ||
fi | ||
} | ||
|
||
|
@@ -126,5 +129,5 @@ index aab3f72e..fe02a6f1 100644 | |
daemondir=${TEST_SCRATCH_DIR}/git-daemon | ||
mkdir -p ${daemondir}/repo | ||
-- | ||
2.37.3 | ||
2.38.1 | ||
|