Skip to content

Commit 950db09

Browse files
committed
test/system: fix broken podman_runtime
This got broken during the remote testing rewrite to enable tls testing in commit feb36e4. The problem is the function didn't use the proper podman command with the remote arg so it tried to connect to the default socket with remote testing. And in the checkpoint file we use it before the PODMAN_CMD was defined so fix this by moving the basic_setup before and the use the variable PODMAN_RUNTIME instead of having to do another info call. Also fix the debug log output to correctly log the podman commands with all arguments on a single line. Fixes: feb36e4 ("Implement TLS API Support") Fixes: #27266 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
1 parent c31104f commit 950db09

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

test/system/520-checkpoint.bats

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ function setup() {
2222
skip "checkpoint does not work rootless"
2323
fi
2424

25+
basic_setup
26+
27+
# Note basic_setup defines $PODMAN_RUNTIME so this must be after it
28+
2529
# As of 2024-05, crun on Debian is not built with criu support:
2630
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008249
27-
runtime=$(podman_runtime)
31+
runtime="$PODMAN_RUNTIME"
2832
run $runtime checkpoint --help
2933
if [[ $status -ne 0 ]]; then
3034
skip "runtime $runtime does not support checkpoint/restore"
3135
fi
32-
33-
basic_setup
3436
}
3537

3638
# bats test_tags=ci:parallel

test/system/helpers.bash

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ function basic_setup() {
185185
# ancient BATS (v1.1) in RHEL gating tests.)
186186
PODMAN_TMPDIR=$(mktemp -d --tmpdir=${BATS_TMPDIR:-/tmp} podman_bats.XXXXXX)
187187

188+
PODMAN_CMD=("${PODMAN}")
189+
add_podman_args PODMAN_CMD
190+
188191
# runtime is not likely to change
189192
if [[ -z "$PODMAN_RUNTIME" ]]; then
190193
PODMAN_RUNTIME=$(podman_runtime)
@@ -208,9 +211,6 @@ function basic_setup() {
208211
# idea being that a large number of failures can show patterns.
209212
ASSERTION_FAILURES=
210213
immediate-assertion-failures
211-
212-
PODMAN_CMD=("${PODMAN}")
213-
add_podman_args PODMAN_CMD
214214
}
215215

216216
# bail-now is how we terminate a test upon assertion failure.
@@ -560,7 +560,7 @@ function run_podman() {
560560

561561

562562
# stdout is only emitted upon error; this printf is to help in debugging
563-
printf "\n%s %s %s %s\n" "$(timestamp)" "$_LOG_PROMPT" $PODMAN "${podman_args[@]}" "$*"
563+
printf "\n%s %s %s %s %s\n" "$(timestamp)" "$_LOG_PROMPT" $PODMAN "${podman_args[*]}" "$*"
564564

565565
# BATS hangs if a subprocess remains and keeps FD 3 open; this happens
566566
# if podman crashes unexpectedly without cleaning up subprocesses.
@@ -790,7 +790,7 @@ function selinux_enabled() {
790790
function podman_runtime() {
791791
# This function is intended to be used as '$(podman_runtime)', i.e.
792792
# our caller wants our output. It's unsafe to use run_podman().
793-
runtime=$($PODMAN $_PODMAN_TEST_OPTS info --format '{{ .Host.OCIRuntime.Name }}' 2>/dev/null)
793+
runtime=$("${PODMAN_CMD[@]}" info --format '{{ .Host.OCIRuntime.Name }}' 2>/dev/null)
794794
basename "${runtime:-[null]}"
795795
}
796796

0 commit comments

Comments
 (0)