Fix run_podman to support exit code with warnings notation (+w)

(cherry picked from commit 652ec9578b)

The test framework was not parsing the '+w' suffix in expected exit
codes (e.g., '0+w' meaning "expect exit code 0 and warnings allowed").
This caused the literal string to be passed as a command argument to
podman, resulting in "unrecognized command" errors.

Added pattern matching for:
- [0-9]+w (single digit with warnings)
- [1-9][0-9]+w (double digit with warnings)
- [12][0-9][0-9]+w (triple digit with warnings)

The '+w' suffix is stripped off and only the numeric exit code is used
for validation. Note: The actual warning validation is not implemented
yet, but this allows tests using the '+w' notation to run correctly.

This fixes the "podman-remote: non-default connection" test failure.

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
Lokesh Mandvekar 2026-01-08 18:48:30 +05:30 • committed by Chris Evich
parent f9a57e0e3e
commit 5a9bf964fb
No known key found for this signature in database
GPG key ID: 03EDC70FD578067F

View file

@ -177,6 +177,9 @@ function run_podman() {
[0-9]) expected_rc=$1; shift;;
[1-9][0-9]) expected_rc=$1; shift;;
[12][0-9][0-9]) expected_rc=$1; shift;;
[0-9]+w) expected_rc=${1%+w}; shift;; # exit code with warnings allowed
[1-9][0-9]+w) expected_rc=${1%+w}; shift;; # exit code with warnings allowed
[12][0-9][0-9]+w) expected_rc=${1%+w}; shift;; # exit code with warnings allowed
'?') expected_rc= ; shift;; # ignore exit code
esac