mirror of
https://github.com/containers/podman.git
synced 2025-05-21 09:05:56 +08:00
@ -189,9 +189,19 @@ echo $rand | 0 | $rand
|
|||||||
|
|
||||||
is "$(< $cidfile)" "$cid" "contents of cidfile == container ID"
|
is "$(< $cidfile)" "$cid" "contents of cidfile == container ID"
|
||||||
|
|
||||||
conmon_pid=$(< $pidfile)
|
# Cross-check --conmon-pidfile against 'podman inspect'
|
||||||
is "$(readlink /proc/$conmon_pid/exe)" ".*/conmon" \
|
local conmon_pid_from_file=$(< $pidfile)
|
||||||
"conmon pidfile (= PID $conmon_pid) points to conmon process"
|
run_podman inspect --format '{{.State.ConmonPid}}' $cid
|
||||||
|
local conmon_pid_from_inspect="$output"
|
||||||
|
is "$conmon_pid_from_file" "$conmon_pid_from_inspect" \
|
||||||
|
"Conmon pid in pidfile matches what 'podman inspect' claims"
|
||||||
|
|
||||||
|
# /proc/PID/exe should be a symlink to a conmon executable
|
||||||
|
# FIXME: 'echo' and 'ls' are to help debug #7580, a CI flake
|
||||||
|
echo "conmon pid = $conmon_pid_from_file"
|
||||||
|
ls -l /proc/$conmon_pid_from_file
|
||||||
|
is "$(readlink /proc/$conmon_pid_from_file/exe)" ".*/conmon" \
|
||||||
|
"conmon pidfile (= PID $conmon_pid_from_file) points to conmon process"
|
||||||
|
|
||||||
# All OK. Kill container.
|
# All OK. Kill container.
|
||||||
run_podman rm -f $cid
|
run_podman rm -f $cid
|
||||||
@ -204,7 +214,7 @@ echo $rand | 0 | $rand
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "podman run docker-archive" {
|
@test "podman run docker-archive" {
|
||||||
skip_if_remote "FIXME: pending #7116"
|
skip_if_remote "podman-remote does not support docker-archive (#7116)"
|
||||||
|
|
||||||
# Create an image that, when run, outputs a random magic string
|
# Create an image that, when run, outputs a random magic string
|
||||||
expect=$(random_string 20)
|
expect=$(random_string 20)
|
||||||
|
@ -27,25 +27,43 @@ verify_iid_and_name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "podman save to pipe and load" {
|
@test "podman save to pipe and load" {
|
||||||
get_iid_and_name
|
# Generate a random name and tag (must be lower-case)
|
||||||
|
local random_name=x$(random_string 12 | tr A-Z a-z)
|
||||||
|
local random_tag=t$(random_string 7 | tr A-Z a-z)
|
||||||
|
local fqin=localhost/$random_name:$random_tag
|
||||||
|
run_podman tag $IMAGE $fqin
|
||||||
|
|
||||||
|
archive=$PODMAN_TMPDIR/myimage-$(random_string 8).tar
|
||||||
|
|
||||||
# We can't use run_podman because that uses the BATS 'run' function
|
# We can't use run_podman because that uses the BATS 'run' function
|
||||||
# which redirects stdout and stderr. Here we need to guarantee
|
# which redirects stdout and stderr. Here we need to guarantee
|
||||||
# that podman's stdout is a pipe, not any other form of redirection
|
# that podman's stdout is a pipe, not any other form of redirection
|
||||||
$PODMAN save --format oci-archive $IMAGE | cat >$archive
|
$PODMAN save --format oci-archive $fqin | cat >$archive
|
||||||
if [ "$status" -ne 0 ]; then
|
if [ "$status" -ne 0 ]; then
|
||||||
die "Command failed: podman save ... | cat"
|
die "Command failed: podman save ... | cat"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure we can reload it
|
# Make sure we can reload it
|
||||||
# FIXME: when/if 7337 gets fixed, add a random tag instead of rmi'ing
|
run_podman rmi $fqin
|
||||||
# FIXME: when/if 7371 gets fixed, use verify_iid_and_name()
|
|
||||||
run_podman rmi $iid
|
|
||||||
run_podman load -i $archive
|
run_podman load -i $archive
|
||||||
|
|
||||||
# FIXME: cannot compare IID, see #7371
|
# FIXME: cannot compare IID, see #7371, so we check only the tag
|
||||||
run_podman images -a --format '{{.Repository}}:{{.Tag}}'
|
run_podman images $fqin --format '{{.Repository}}:{{.Tag}}'
|
||||||
is "$output" "$IMAGE" "image preserves name across save/load"
|
is "$output" "$fqin" "image preserves name across save/load"
|
||||||
|
|
||||||
|
# FIXME: when/if 7337 gets fixed, load with a new tag
|
||||||
|
if false; then
|
||||||
|
local new_name=x$(random_string 14 | tr A-Z a-z)
|
||||||
|
local new_tag=t$(random_string 6 | tr A-Z a-z)
|
||||||
|
run_podman rmi $fqin
|
||||||
|
fqin=localhost/$new_name:$new_tag
|
||||||
|
run_podman load -i $archive $fqin
|
||||||
|
run_podman images $fqin --format '{{.Repository}}:{{.Tag}}'
|
||||||
|
is "$output" "$fqin" "image can be loaded with new name:tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
run_podman rmi $fqin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user