Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: system tests: instrument to allow failure analysis #23378

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions test/system/040-ps.bats
Original file line number Diff line number Diff line change
Expand Up @@ -144,27 +144,35 @@ load helpers

# Ok this here is basically a way to reproduce a "leaked" podman build buildah
# container without having to kill any process and usage of sleep.
echo;echo "$_LOG_PROMPT buildah from $IMAGE"
run buildah from $IMAGE
assert "$status" -eq 0 "buildah from successfully"
echo "$output"
assert "$status" -eq 0 "status of buildah from"
buildah_cid="$output"

# Commit new image so we have something to prune.
echo;echo "$_LOG_PROMPT buildah commit $buildah_cid"
run buildah commit $buildah_cid
assert "$status" -eq 0 "buildah commit successfully"
echo "$output"
assert "$status" -eq 0 "status of buildah commit"
buildah_image_id="${lines[-1]}"

# Create new buildah container with new image so that one can be pruned directly.
echo;echo "$_LOG_PROMPT buildah from $buildah_image_id"
run buildah from "$buildah_image_id"
assert "$status" -eq 0 "buildah from new buildah image successfully"
echo "$output"
assert "$status" -eq 0 "status of buildah from new buildah image"

# We have to mount the container to trigger the "container .* is mounted" check below.
local unshare=
if is_rootless; then
# rootless needs unshare for mounting
unshare="buildah unshare"
fi
echo;echo "$_LOG_PROMPT $unshare buildah mount $buildah_cid"
run $unshare buildah mount "$buildah_cid"
assert "$status" -eq 0 "buildah mount container successfully"
echo "$output"
assert "$status" -eq 0 "status of buildah mount container"

run_podman ps -a
is "${#lines[@]}" "1" "podman ps -a does not see buildah containers"
Expand Down
10 changes: 8 additions & 2 deletions test/system/260-sdnotify.bats
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,17 @@ ignore"
is "$output" "0" "container exited cleanly after sending READY message"

wait_for_file_content $_SOCAT_LOG "READY=1"
assert "$(< $_SOCAT_LOG)" =~ "MAINPID=.*

# (for debugging)
echo;echo "$_LOG_PROMPT cat $_SOCAT_LOG"
run cat $_SOCAT_LOG
echo "$output"

assert "$output" =~ "MAINPID=.*
READY=1" "sdnotify sent MAINPID and READY"

# Make sure that Podman is the service's MainPID
main_pid=$(head -n1 $_SOCAT_LOG | awk -F= '{print $2}')
main_pid=$(head -n1 <<<"$output" | awk -F= '{print $2}')
is "$(</proc/$main_pid/comm)" "podman" "podman is the service mainPID ($main_pid)"
_stop_socat

Expand Down