From 0c99f623aa7cf6063badb7edb38ead1a90922a6d Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 15:04:20 +0100 Subject: [PATCH 1/9] test/e2e: try to fix clean up after terminated build flake It is failing with: replacing mount point ".../root/overlay/xxx/merged": directory not empty First, the build does not need network so ensure we don't leak network allocations by killing it. Second, kill is always async so ensure to wait for the actul build process exit. Signed-off-by: Paul Holzinger --- test/e2e/prune_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go index 4d7fd57a4c..40b498be78 100644 --- a/test/e2e/prune_test.go +++ b/test/e2e/prune_test.go @@ -12,6 +12,7 @@ import ( . "github.com/containers/podman/v5/test/utils" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + . "github.com/onsi/gomega/gexec" ) var pruneImage = fmt.Sprintf(` @@ -601,7 +602,7 @@ var _ = Describe("Podman prune", func() { err := os.WriteFile(containerFilePath, []byte(longBuildImage), 0o755) Expect(err).ToNot(HaveOccurred()) - build := podmanTest.Podman([]string{"build", "-f", containerFilePath, "-t", "podmanleaker"}) + build := podmanTest.Podman([]string{"build", "--network=none", "-f", containerFilePath, "-t", "podmanleaker"}) // Build will never finish so let's wait for build to ask for SIGKILL to simulate a failed build that leaves stage containers. matchedOutput := false for range 900 { @@ -616,6 +617,10 @@ var _ = Describe("Podman prune", func() { Fail("Did not match special string in podman build") } + // kill is async, wait for process exit here and make sure it was killed (137). + build.WaitWithDefaultTimeout() + Expect(build).To(Exit(137)) + // Check Intermediate image of stage container none := podmanTest.Podman([]string{"images", "-a"}) none.WaitWithDefaultTimeout() From 199254f039ac0da64b6fe293570e2e3798b0e738 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 15:28:15 +0100 Subject: [PATCH 2/9] test/system: skip flaky restore test on debian Somehow this only flakes on debian as it seem the /etc/hosts file on the host system changes and thus causes a false postive with the before/after restore comparison. Signed-off-by: Paul Holzinger --- test/system/520-checkpoint.bats | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/system/520-checkpoint.bats b/test/system/520-checkpoint.bats index 630f4d016e..e83c597f4a 100644 --- a/test/system/520-checkpoint.bats +++ b/test/system/520-checkpoint.bats @@ -236,6 +236,12 @@ function setup() { # bats test_tags=ci:parallel @test "podman checkpoint/restore ip and mac handling" { + # Broken only debian as it seems the host's /etc/hosts file keeps changing + # which causes false positives in the before/after restore comparison. + OS_RELEASE_ID="${OS_RELEASE_ID:-$(source /etc/os-release; echo $ID)}" + if [[ "$OS_RELEASE_ID" == "debian" ]]; then + skip "Test flakes on debian in CI" + fi # Refer to https://github.com/containers/podman/issues/16666#issuecomment-1337860545 # for the correct behavior, this should cover all cases listed there. local netname="net-$(safename)" From bfddcb3384adcb6d533b768af94cf87497a3abb2 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 16:57:53 +0100 Subject: [PATCH 3/9] test/system: do not run artifact test in parallel They do not seem safe to use concurrently, see #27264. Signed-off-by: Paul Holzinger --- test/system/700-artifact.bats | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/system/700-artifact.bats b/test/system/700-artifact.bats index 19116f3083..b520fbc102 100644 --- a/test/system/700-artifact.bats +++ b/test/system/700-artifact.bats @@ -5,6 +5,8 @@ load helpers +# FIXME #27264: Artifact store does not seem to work properly with concurrent access. Do not the ci:parallel tags here! + function setup() { basic_setup } @@ -21,7 +23,6 @@ create_test_file() { echo "$filename" } -# bats test_tags=ci:parallel @test "podman artifact add --replace basic functionality" { local artifact_name="localhost/test/replace-artifact" local file1 file2 @@ -51,7 +52,6 @@ create_test_file() { rm -f "$file1" "$file2" } -# bats test_tags=ci:parallel @test "podman artifact add --replace nonexistent artifact" { local artifact_name="localhost/test/nonexistent-artifact" local file1 @@ -69,7 +69,6 @@ create_test_file() { rm -f "$file1" } -# bats test_tags=ci:parallel @test "podman artifact add --replace and --append conflict" { local artifact_name="localhost/test/conflict-artifact" local file1 @@ -83,7 +82,6 @@ create_test_file() { rm -f "$file1" } -# bats test_tags=ci:parallel @test "podman artifact add --replace with existing artifact" { local artifact_name="localhost/test/existing-artifact" local file1 file2 From 372e14225224c3d4e5e852bc6df22bf09dca3c82 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 17:21:50 +0100 Subject: [PATCH 4/9] test/system: remove 701-artifact-created.bats The tests there are a duplicate compared to the 702 file. Signed-off-by: Paul Holzinger --- test/system/701-artifact-created.bats | 107 -------------------------- 1 file changed, 107 deletions(-) delete mode 100644 test/system/701-artifact-created.bats diff --git a/test/system/701-artifact-created.bats b/test/system/701-artifact-created.bats deleted file mode 100644 index be0c396cba..0000000000 --- a/test/system/701-artifact-created.bats +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env bats -*- bats -*- -# -# Tests for podman artifact created date functionality -# - -load helpers - -# Create temporary artifact file for testing -function create_test_file() { - local content="$1" - local filename=$(random_string 12) - local filepath="$PODMAN_TMPDIR/$filename.txt" - echo "$content" > "$filepath" - echo "$filepath" -} - -function setup() { - basic_setup - skip_if_remote "artifacts are not remote" -} - -function teardown() { - run_podman artifact rm --all --ignore || true - basic_teardown -} - -@test "podman artifact inspect shows created date in RFC3339" { - local content="test content for created date" - local testfile=$(create_test_file "$content") - local artifact_name="localhost/test/created-test" - - # Record time before creation (in seconds for comparison) - local before_epoch=$(date +%s) - - # Create artifact - run_podman artifact add $artifact_name "$testfile" - - # Record time after creation (in seconds for comparison) - local after_epoch=$(date +%s) - - # Inspect the artifact - run_podman artifact inspect $artifact_name - local output="$output" - - # Parse the JSON output to get the created annotation - local created_annotation - created_annotation=$(echo "$output" | jq -r '.Manifest.annotations["org.opencontainers.image.created"]') - - # Verify created annotation exists and is not null - assert "$created_annotation" != "null" "Should have org.opencontainers.image.created annotation" - assert "$created_annotation" != "" "Created annotation should not be empty" - - # Verify it's a valid RFC3339 timestamp by trying to parse it - # Convert to epoch for comparison - local created_epoch - created_epoch=$(date -d "$created_annotation" +%s 2>/dev/null) - - # Verify parsing succeeded - assert "$?" -eq 0 "Created timestamp should be valid RFC3339 format" - - # Verify timestamp is within reasonable bounds - assert "$created_epoch" -ge "$before_epoch" "Created time should be after before_epoch" - assert "$created_epoch" -le "$after_epoch" "Created time should be before after_epoch" - - # Clean up - rm -f "$testfile" -} - -@test "podman artifact append preserves original created date" { - local content1="initial content" - local content2="appended content" - local testfile1=$(create_test_file "$content1") - local testfile2=$(create_test_file "$content2") - local artifact_name="localhost/test/append-test" - - # Create initial artifact - run_podman artifact add $artifact_name "$testfile1" - - # Get the original created timestamp - run_podman artifact inspect $artifact_name - local original_created - original_created=$(echo "$output" | jq -r '.Manifest.annotations["org.opencontainers.image.created"]') - - # Wait a bit to ensure timestamps would differ if created new - sleep 1 - - # Append to artifact - run_podman artifact add --append $artifact_name "$testfile2" - - # Get the created timestamp after append - run_podman artifact inspect $artifact_name - local current_created - current_created=$(echo "$output" | jq -r '.Manifest.annotations["org.opencontainers.image.created"]') - - # Verify the created timestamp is preserved - assert "$current_created" = "$original_created" "Created timestamp should be preserved during append" - - # Verify we have 2 layers now - local layer_count - layer_count=$(echo "$output" | jq '.Manifest.layers | length') - assert "$layer_count" -eq 2 "Should have 2 layers after append" - - # Clean up - rm -f "$testfile1" "$testfile2" -} - -# vim: filetype=sh From 58733d714aed8d1638324a0c3e32b9eaec74cedd Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 17:32:06 +0100 Subject: [PATCH 5/9] test/system: rework artifact created test - use nanoseconds, so we don't need to sleep a full second do put the time forward. - use the --format option instead of jq - run test via remote as well - don't use static file content Fixes: #27265 Signed-off-by: Paul Holzinger --- test/system/702-artifact-created.bats | 52 ++++++++------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/test/system/702-artifact-created.bats b/test/system/702-artifact-created.bats index ffa10d4f25..441afc3d71 100644 --- a/test/system/702-artifact-created.bats +++ b/test/system/702-artifact-created.bats @@ -7,56 +7,40 @@ load helpers # Create temporary artifact file for testing function create_test_file() { - local content="$1" + local content="$(random_string 100)" local filename=$(random_string 12) local filepath="$PODMAN_TMPDIR/$filename.txt" echo "$content" > "$filepath" echo "$filepath" } -function setup() { - basic_setup - skip_if_remote "artifacts are not remote" -} - function teardown() { - run_podman artifact rm --all --ignore || true + run_podman artifact rm --all --ignore basic_teardown } @test "podman artifact inspect shows created date in RFC3339 format" { - local content="test content for created date" - local testfile1=$(create_test_file "$content") + local testfile1=$(create_test_file) local artifact_name="localhost/test/created-test" - local content2="appended content" - local testfile2=$(create_test_file "$content2") + local testfile2=$(create_test_file) - # Record time before creation (in seconds for comparison) - local before_epoch=$(date +%s) + # Record time before creation (in nanoseconds for comparison) + local before_epoch=$(date +%s%N) # Create artifact run_podman artifact add $artifact_name "$testfile1" - # Record time after creation (in seconds for comparison) - local after_epoch=$(date +%s) - after_epoch=$((after_epoch + 1)) + # Record time after creation + local after_epoch=$(date +%s%N) # Inspect the artifact - run_podman artifact inspect $artifact_name - local output="$output" - - # Parse the JSON output to get the created annotation - local created_annotation - created_annotation=$(echo "$output" | jq -r '.Manifest.annotations["org.opencontainers.image.created"]') - - # Verify created annotation exists and is not null - assert "$created_annotation" != "null" "Should have org.opencontainers.image.created annotation" + run_podman artifact inspect --format '{{index .Manifest.Annotations "org.opencontainers.image.created" }}' $artifact_name + local created_annotation="$output" assert "$created_annotation" != "" "Created annotation should not be empty" # Verify it's a valid RFC3339 timestamp by trying to parse it # Convert to epoch for comparison - local created_epoch - created_epoch=$(date -d "$created_annotation" +%s 2>/dev/null) + local created_epoch=$(date -d "$created_annotation" +%s%N 2>/dev/null) # Verify parsing succeeded assert "$?" -eq 0 "Created timestamp should be valid RFC3339 format" @@ -65,27 +49,19 @@ function teardown() { assert "$created_epoch" -ge "$before_epoch" "Created time should be after before_epoch" assert "$created_epoch" -le "$after_epoch" "Created time should be before after_epoch" - # Wait a bit to ensure timestamps would differ if created new - sleep 1 - # Append to artifact run_podman artifact add --append $artifact_name "$testfile2" # Get the created timestamp after append - run_podman artifact inspect $artifact_name - local current_created - current_created=$(echo "$output" | jq -r '.Manifest.annotations["org.opencontainers.image.created"]') + run_podman artifact inspect --format '{{index .Manifest.Annotations "org.opencontainers.image.created" }}\n{{len .Manifest.Layers}}' $artifact_name + local current_created="${lines[0]}" + local layer_count="${lines[1]}" # Verify the created timestamp is preserved assert "$current_created" = "$created_annotation" "Created timestamp should be preserved during append" # Verify we have 2 layers now - local layer_count - layer_count=$(echo "$output" | jq '.Manifest.layers | length') assert "$layer_count" -eq 2 "Should have 2 layers after append" - - # Clean up - rm -f "$testfile1" "$testfile2" } # vim: filetype=sh From e737d75b2f3eb58efedb10e9947b773964f81ed8 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 17:37:13 +0100 Subject: [PATCH 6/9] test/system: merge artifact tests into single file There is no need for several files here, it just means the setup and helpers get duplicated. Signed-off-by: Paul Holzinger --- test/system/702-artifact-created.bats | 67 ---------------- .../{700-artifact.bats => 702-artifact.bats} | 77 +++++++++++++++---- 2 files changed, 62 insertions(+), 82 deletions(-) delete mode 100644 test/system/702-artifact-created.bats rename test/system/{700-artifact.bats => 702-artifact.bats} (51%) diff --git a/test/system/702-artifact-created.bats b/test/system/702-artifact-created.bats deleted file mode 100644 index 441afc3d71..0000000000 --- a/test/system/702-artifact-created.bats +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bats -*- bats -*- -# -# Tests for podman artifact created date functionality -# - -load helpers - -# Create temporary artifact file for testing -function create_test_file() { - local content="$(random_string 100)" - local filename=$(random_string 12) - local filepath="$PODMAN_TMPDIR/$filename.txt" - echo "$content" > "$filepath" - echo "$filepath" -} - -function teardown() { - run_podman artifact rm --all --ignore - basic_teardown -} - -@test "podman artifact inspect shows created date in RFC3339 format" { - local testfile1=$(create_test_file) - local artifact_name="localhost/test/created-test" - local testfile2=$(create_test_file) - - # Record time before creation (in nanoseconds for comparison) - local before_epoch=$(date +%s%N) - - # Create artifact - run_podman artifact add $artifact_name "$testfile1" - - # Record time after creation - local after_epoch=$(date +%s%N) - - # Inspect the artifact - run_podman artifact inspect --format '{{index .Manifest.Annotations "org.opencontainers.image.created" }}' $artifact_name - local created_annotation="$output" - assert "$created_annotation" != "" "Created annotation should not be empty" - - # Verify it's a valid RFC3339 timestamp by trying to parse it - # Convert to epoch for comparison - local created_epoch=$(date -d "$created_annotation" +%s%N 2>/dev/null) - - # Verify parsing succeeded - assert "$?" -eq 0 "Created timestamp should be valid RFC3339 format" - - # Verify timestamp is within reasonable bounds - assert "$created_epoch" -ge "$before_epoch" "Created time should be after before_epoch" - assert "$created_epoch" -le "$after_epoch" "Created time should be before after_epoch" - - # Append to artifact - run_podman artifact add --append $artifact_name "$testfile2" - - # Get the created timestamp after append - run_podman artifact inspect --format '{{index .Manifest.Annotations "org.opencontainers.image.created" }}\n{{len .Manifest.Layers}}' $artifact_name - local current_created="${lines[0]}" - local layer_count="${lines[1]}" - - # Verify the created timestamp is preserved - assert "$current_created" = "$created_annotation" "Created timestamp should be preserved during append" - - # Verify we have 2 layers now - assert "$layer_count" -eq 2 "Should have 2 layers after append" -} - -# vim: filetype=sh diff --git a/test/system/700-artifact.bats b/test/system/702-artifact.bats similarity index 51% rename from test/system/700-artifact.bats rename to test/system/702-artifact.bats index b520fbc102..7767c6613c 100644 --- a/test/system/700-artifact.bats +++ b/test/system/702-artifact.bats @@ -1,34 +1,78 @@ #!/usr/bin/env bats -*- bats -*- # -# Tests for podman artifact functionality +# Tests for podman artifact created date functionality # load helpers # FIXME #27264: Artifact store does not seem to work properly with concurrent access. Do not the ci:parallel tags here! -function setup() { - basic_setup +# Create temporary artifact file for testing +function create_test_file() { + local content="$(random_string 100)" + local filename=$(random_string 12) + local filepath="$PODMAN_TMPDIR/$filename.txt" + echo "$content" > "$filepath" + echo "$filepath" } function teardown() { + run_podman artifact rm --all --ignore basic_teardown } -# Helper function to create a test artifact file -create_test_file() { - local size=${1:-1024} - local filename=$(mktemp --tmpdir="${PODMAN_TMPDIR}" artifactfile.XXXXXX) - dd if=/dev/urandom of="$filename" bs=1 count="$size" 2>/dev/null - echo "$filename" +@test "podman artifact inspect shows created date in RFC3339 format" { + local testfile1=$(create_test_file) + local artifact_name="localhost/test/created-test" + local testfile2=$(create_test_file) + + # Record time before creation (in nanoseconds for comparison) + local before_epoch=$(date +%s%N) + + # Create artifact + run_podman artifact add $artifact_name "$testfile1" + + # Record time after creation + local after_epoch=$(date +%s%N) + + # Inspect the artifact + run_podman artifact inspect --format '{{index .Manifest.Annotations "org.opencontainers.image.created" }}' $artifact_name + local created_annotation="$output" + assert "$created_annotation" != "" "Created annotation should not be empty" + + # Verify it's a valid RFC3339 timestamp by trying to parse it + # Convert to epoch for comparison + local created_epoch=$(date -d "$created_annotation" +%s%N 2>/dev/null) + + # Verify parsing succeeded + assert "$?" -eq 0 "Created timestamp should be valid RFC3339 format" + + # Verify timestamp is within reasonable bounds + assert "$created_epoch" -ge "$before_epoch" "Created time should be after before_epoch" + assert "$created_epoch" -le "$after_epoch" "Created time should be before after_epoch" + + # Append to artifact + run_podman artifact add --append $artifact_name "$testfile2" + + # Get the created timestamp after append + run_podman artifact inspect --format '{{index .Manifest.Annotations "org.opencontainers.image.created" }}\n{{len .Manifest.Layers}}' $artifact_name + local current_created="${lines[0]}" + local layer_count="${lines[1]}" + + # Verify the created timestamp is preserved + assert "$current_created" = "$created_annotation" "Created timestamp should be preserved during append" + + # Verify we have 2 layers now + assert "$layer_count" -eq 2 "Should have 2 layers after append" } + @test "podman artifact add --replace basic functionality" { local artifact_name="localhost/test/replace-artifact" local file1 file2 - file1=$(create_test_file 1024) - file2=$(create_test_file 2048) + file1=$(create_test_file) + file2=$(create_test_file) # Add initial artifact run_podman artifact add "$artifact_name" "$file1" @@ -56,7 +100,7 @@ create_test_file() { local artifact_name="localhost/test/nonexistent-artifact" local file1 - file1=$(create_test_file 1024) + file1=$(create_test_file) # Using --replace on nonexistent artifact should succeed run_podman artifact add --replace "$artifact_name" "$file1" @@ -73,7 +117,7 @@ create_test_file() { local artifact_name="localhost/test/conflict-artifact" local file1 - file1=$(create_test_file 1024) + file1=$(create_test_file) # Using --replace and --append together should fail run_podman 125 artifact add --replace --append "$artifact_name" "$file1" @@ -86,8 +130,8 @@ create_test_file() { local artifact_name="localhost/test/existing-artifact" local file1 file2 - file1=$(create_test_file 512) - file2=$(create_test_file 1024) + file1=$(create_test_file) + file2=$(create_test_file) # Create initial artifact run_podman artifact add "$artifact_name" "$file1" @@ -109,3 +153,6 @@ create_test_file() { run_podman artifact rm "$artifact_name" rm -f "$file1" "$file2" } + + +# vim: filetype=sh From 708f7a14f31e3a7e4e8a7006074c4c2036660473 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 17:40:05 +0100 Subject: [PATCH 7/9] test/system: fix artifact test cleanup Make sure to rmeove the artifact but we don't need to remove the testfiles as they are part under PODMAN_TMPDIR which gets removed by default so don't bother with that. Signed-off-by: Paul Holzinger --- test/system/702-artifact.bats | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/system/702-artifact.bats b/test/system/702-artifact.bats index 7767c6613c..df23645d27 100644 --- a/test/system/702-artifact.bats +++ b/test/system/702-artifact.bats @@ -64,6 +64,8 @@ function teardown() { # Verify we have 2 layers now assert "$layer_count" -eq 2 "Should have 2 layers after append" + + run_podman artifact rm "$artifact_name" } @@ -93,7 +95,6 @@ function teardown() { # Cleanup run_podman artifact rm "$artifact_name" - rm -f "$file1" "$file2" } @test "podman artifact add --replace nonexistent artifact" { @@ -110,7 +111,6 @@ function teardown() { # Cleanup run_podman artifact rm "$artifact_name" - rm -f "$file1" } @test "podman artifact add --replace and --append conflict" { @@ -122,8 +122,6 @@ function teardown() { # Using --replace and --append together should fail run_podman 125 artifact add --replace --append "$artifact_name" "$file1" assert "$output" =~ "--append and --replace options cannot be used together" - - rm -f "$file1" } @test "podman artifact add --replace with existing artifact" { @@ -151,7 +149,6 @@ function teardown() { # Cleanup run_podman artifact rm "$artifact_name" - rm -f "$file1" "$file2" } From 129c344b49fbb3bfea7b11e42178e696a1717d7c Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 17:59:00 +0100 Subject: [PATCH 8/9] test/system: fix broken podman_runtime This got broken during the remote testing rewrite to enable tls testing in commit feb36e4fe6. 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: feb36e4fe6 ("Implement TLS API Support") Fixes: #27266 Signed-off-by: Paul Holzinger --- test/system/520-checkpoint.bats | 8 +++++--- test/system/helpers.bash | 10 +++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/test/system/520-checkpoint.bats b/test/system/520-checkpoint.bats index e83c597f4a..b19eb88d61 100644 --- a/test/system/520-checkpoint.bats +++ b/test/system/520-checkpoint.bats @@ -22,15 +22,17 @@ function setup() { skip "checkpoint does not work rootless" fi + basic_setup + + # Note basic_setup defines $PODMAN_RUNTIME so this must be after it + # As of 2024-05, crun on Debian is not built with criu support: # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008249 - runtime=$(podman_runtime) + runtime="$PODMAN_RUNTIME" run $runtime checkpoint --help if [[ $status -ne 0 ]]; then skip "runtime $runtime does not support checkpoint/restore" fi - - basic_setup } # bats test_tags=ci:parallel diff --git a/test/system/helpers.bash b/test/system/helpers.bash index 5abfe872d3..d6bfa31b32 100644 --- a/test/system/helpers.bash +++ b/test/system/helpers.bash @@ -185,6 +185,9 @@ function basic_setup() { # ancient BATS (v1.1) in RHEL gating tests.) PODMAN_TMPDIR=$(mktemp -d --tmpdir=${BATS_TMPDIR:-/tmp} podman_bats.XXXXXX) + PODMAN_CMD=("${PODMAN}") + add_podman_args PODMAN_CMD + # runtime is not likely to change if [[ -z "$PODMAN_RUNTIME" ]]; then PODMAN_RUNTIME=$(podman_runtime) @@ -208,9 +211,6 @@ function basic_setup() { # idea being that a large number of failures can show patterns. ASSERTION_FAILURES= immediate-assertion-failures - - PODMAN_CMD=("${PODMAN}") - add_podman_args PODMAN_CMD } # bail-now is how we terminate a test upon assertion failure. @@ -560,7 +560,7 @@ function run_podman() { # stdout is only emitted upon error; this printf is to help in debugging - printf "\n%s %s %s %s\n" "$(timestamp)" "$_LOG_PROMPT" $PODMAN "${podman_args[@]}" "$*" + printf "\n%s %s %s %s %s\n" "$(timestamp)" "$_LOG_PROMPT" $PODMAN "${podman_args[*]}" "$*" # BATS hangs if a subprocess remains and keeps FD 3 open; this happens # if podman crashes unexpectedly without cleaning up subprocesses. @@ -790,7 +790,7 @@ function selinux_enabled() { function podman_runtime() { # This function is intended to be used as '$(podman_runtime)', i.e. # our caller wants our output. It's unsafe to use run_podman(). - runtime=$($PODMAN $_PODMAN_TEST_OPTS info --format '{{ .Host.OCIRuntime.Name }}' 2>/dev/null) + runtime=$("${PODMAN_CMD[@]}" info --format '{{ .Host.OCIRuntime.Name }}' 2>/dev/null) basename "${runtime:-[null]}" } From b6b8d23abd6f4d348bd64ee79bdcc45ef0d372b6 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Fri, 7 Nov 2025 18:04:26 +0100 Subject: [PATCH 9/9] hack/bats: port it to use the new remote support The system tests can setup their own server now so just use that and don't require the user to spawn its own. Signed-off-by: Paul Holzinger --- hack/bats | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/hack/bats b/hack/bats index e416f82d15..505b890440 100755 --- a/hack/bats +++ b/hack/bats @@ -12,7 +12,7 @@ $0 is a wrapper for invoking podman system tests. --root Run only as root --rootless Run only as user (i.e. you) - --remote Run with podman-remote (see below) + --remote Run with podman-remote FILENAME-PATTERN Run only test files that match 'test/system/*name*', e.g. '500' or 'net' will match 500-networking.bats. @@ -36,16 +36,6 @@ By default, tests ./bin/podman. To test a different podman, do: \$ env PODMAN=/abs/path/to/podman $0 .... -To test podman-remote, start your own servers (root and rootless) via: - - \$ bin/podman system service --timeout=0 & - \$ sudo !! - -...then invoke this script with --remote. (This script can't start the -servers, because we can sudo *starting* the service but can't sudo -stopping it: by the time the bats tests finish, the sudo timeout will -have expired. We apologize for the inconvenience.) - Examples: \$ $0 220:\"restart cleans up\" @@ -113,13 +103,7 @@ if [[ "$REMOTE" ]]; then if ! [[ $PODMAN =~ -remote ]]; then PODMAN=${PODMAN}-remote fi - - if [[ -n "$TEST_ROOT" ]]; then - sudo $PODMAN info >/dev/null || exit 1 - fi - if [[ -n "$TEST_ROOTLESS" ]]; then - $PODMAN info >/dev/null || exit 1 - fi + export REMOTESYSTEM_TRANSPORT=unix fi # END initialization and command-line arg checking