-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EXPERIMENTAL, AND BROKEN: parallelize podman-remote tests
Not working on my laptop: two tests just hang. Am pushing anyway as a starting point for some motivated team member. Good luck! Signed-off-by: Ed Santiago <[email protected]>
- Loading branch information
1 parent
c02ccd4
commit 247d9e5
Showing
1 changed file
with
16 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
From af4e93ad93b38d085bc5a236fc5da0ad4106d7c2 Mon Sep 17 00:00:00 2001 | ||
From 19c1c40245588ce116933565011da4c12386b696 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 | 119 +++++++++++++++++++++++++++++++++++++++++++-- | ||
1 file changed, 115 insertions(+), 4 deletions(-) | ||
tests/helpers.bash | 121 +++++++++++++++++++++++++++++++++++++++++++-- | ||
1 file changed, 117 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/tests/helpers.bash b/tests/helpers.bash | ||
index ed5de994e..0671a52d8 100644 | ||
index ed5de994e..49c5d2c7c 100644 | ||
--- a/tests/helpers.bash | ||
+++ b/tests/helpers.bash | ||
@@ -80,6 +80,38 @@ EOF | ||
@@ -80,6 +80,40 @@ EOF | ||
BUILDAH_REGISTRY_OPTS="${regconfopt} ${regconfdir} --short-name-alias-conf ${TEST_SCRATCH_DIR}/cache/shortnames.conf" | ||
COPY_REGISTRY_OPTS="${BUILDAH_REGISTRY_OPTS}" | ||
PODMAN_REGISTRY_OPTS="${regconfopt}" | ||
+ PODMAN_REMOTE_OPTS= | ||
+ | ||
+ PODMAN_SERVER_PID= | ||
+ PODMAN_NATIVE="${PODMAN_BINARY} ${ROOTDIR_OPTS} ${PODMAN_REGISTRY_OPTS}" | ||
|
@@ -33,11 +34,12 @@ index ed5de994e..0671a52d8 100644 | |
+ if is_rootless; then | ||
+ sockdir=${XDG_RUNTIME_DIR:-/run/user/$(id -u)} | ||
+ fi | ||
+ PODMAN_SOCK_FILE=$sockdir/podman/podman.sock | ||
+ PODMAN_SOCK_FILE=$sockdir/podman/podman-${BATS_SUITE_TEST_NUMBER}.sock | ||
+ PODMAN_REMOTE_OPTS="--url unix://${PODMAN_SOCK_FILE}" | ||
+ # static CONTAINERS_CONF needed for capabilities test. As of 2021-07-01 | ||
+ # no tests in bud.bats override this; if at some point any test does | ||
+ # so, it will probably need to be skip_if_remote()d. | ||
+ env CONTAINERS_CONF_OVERRIDE=${CONTAINERS_CONF_OVERRIDE:-$(dirname ${BASH_SOURCE})/containers.conf} $PODMAN_NATIVE system service --log-level=info --timeout=0 &>>${PODMAN_SERVER_LOG:-/dev/stderr} & | ||
+ env CONTAINERS_CONF_OVERRIDE=${CONTAINERS_CONF_OVERRIDE:-$(dirname ${BASH_SOURCE})/containers.conf} $PODMAN_NATIVE system service --log-level=info --timeout=0 unix://${PODMAN_SOCK_FILE} &>>${PODMAN_SERVER_LOG:-/dev/stderr} & | ||
+ PODMAN_SERVER_PID=$! | ||
+ echo ">> pid=$PODMAN_SERVER_PID" >>${PODMAN_SERVER_LOG:-/dev/stderr} | ||
+ local timeout=10 | ||
|
@@ -51,7 +53,7 @@ index ed5de994e..0671a52d8 100644 | |
} | ||
|
||
function starthttpd() { # directory [working-directory-or-"" [certfile, keyfile]] | ||
@@ -144,6 +176,32 @@ function teardown_tests() { | ||
@@ -144,6 +178,32 @@ function teardown_tests() { | ||
stop_git_daemon | ||
stop_registry | ||
|
||
|
@@ -84,21 +86,21 @@ index ed5de994e..0671a52d8 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. | ||
@@ -265,7 +323,12 @@ function copy() { | ||
@@ -265,7 +325,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= | ||
+ opts="${PODMAN_REMOTE_OPTS}" | ||
+ fi | ||
+ command $cmd $opts "$@" | ||
} | ||
|
||
# There are various scenarios where we would like to execute `tests` as rootless user, however certain commands like `buildah mount` | ||
@@ -329,8 +392,36 @@ function run_buildah() { | ||
@@ -329,8 +394,36 @@ function run_buildah() { | ||
--retry) retry=3; shift;; # retry network flakes | ||
esac | ||
|
||
|
@@ -117,7 +119,7 @@ index ed5de994e..0671a52d8 100644 | |
+ podman_or_buildah=${PODMAN_BINARY} | ||
+ _opts="${ROOTDIR_OPTS} ${PODMAN_REGISTRY_OPTS}" | ||
+ if [[ -n "$REMOTE" ]]; then | ||
+ _opts= | ||
+ _opts="${PODMAN_REMOTE_OPTS}" | ||
+ fi | ||
+ | ||
+ # Special case: there's one test that invokes git in such | ||
|
@@ -136,7 +138,7 @@ index ed5de994e..0671a52d8 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. | ||
@@ -344,8 +435,8 @@ function run_buildah() { | ||
@@ -344,8 +437,8 @@ function run_buildah() { | ||
retry=$(( retry - 1 )) | ||
|
||
# stdout is only emitted upon error; this echo is to help a debugger | ||
|
@@ -147,7 +149,7 @@ index ed5de994e..0671a52d8 100644 | |
# without "quotes", multiple lines are glommed together into one | ||
if [ -n "$output" ]; then | ||
echo "$output" | ||
@@ -706,6 +797,26 @@ function skip_if_no_unshare() { | ||
@@ -706,6 +799,26 @@ function skip_if_no_unshare() { | ||
fi | ||
} | ||
|
||
|