mirror of
https://github.com/containers/podman.git
synced 2025-06-27 21:50:18 +08:00
system tests: various
- images: confirm that 'podman images' emits headings even if there are no images present. Intended to replace e2e test which is difficult to get working under podman-remote. - build: add test for #8092, podman-build gobbling stdin. Workaround needed for issues #8342 and #8343, in which podman-remote output differs from podman local. - volumes: add test for #8307, double-lock on same volume. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -3,10 +3,18 @@
|
|||||||
load helpers
|
load helpers
|
||||||
|
|
||||||
@test "podman images - basic output" {
|
@test "podman images - basic output" {
|
||||||
run_podman images -a
|
headings="REPOSITORY *TAG *IMAGE ID *CREATED *SIZE"
|
||||||
|
|
||||||
is "${lines[0]}" "REPOSITORY *TAG *IMAGE ID *CREATED *SIZE" "header line"
|
run_podman images -a
|
||||||
|
is "${lines[0]}" "$headings" "header line"
|
||||||
is "${lines[1]}" "$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME *$PODMAN_TEST_IMAGE_TAG *[0-9a-f]\+" "podman images output"
|
is "${lines[1]}" "$PODMAN_TEST_IMAGE_REGISTRY/$PODMAN_TEST_IMAGE_USER/$PODMAN_TEST_IMAGE_NAME *$PODMAN_TEST_IMAGE_TAG *[0-9a-f]\+" "podman images output"
|
||||||
|
|
||||||
|
# 'podman images' should emit headings even if there are no images
|
||||||
|
# (but --root only works locally)
|
||||||
|
if ! is_remote; then
|
||||||
|
run_podman --root ${PODMAN_TMPDIR}/nothing-here-move-along images
|
||||||
|
is "$output" "$headings" "'podman images' emits headings even w/o images"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "podman images - custom formats" {
|
@test "podman images - custom formats" {
|
||||||
|
@ -318,6 +318,63 @@ EOF
|
|||||||
run_podman rmi -f build_test
|
run_podman rmi -f build_test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# #8092 - podman build should not gobble stdin (Fixes: #8066)
|
||||||
|
@test "podman build - does not gobble stdin that does not belong to it" {
|
||||||
|
random1=random1-$(random_string 12)
|
||||||
|
random2=random2-$(random_string 15)
|
||||||
|
random3=random3-$(random_string 12)
|
||||||
|
|
||||||
|
tmpdir=$PODMAN_TMPDIR/build-test
|
||||||
|
mkdir -p $tmpdir
|
||||||
|
cat >$tmpdir/Containerfile <<EOF
|
||||||
|
FROM $IMAGE
|
||||||
|
RUN echo x${random2}y
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# This is a little rococo, bear with me please. #8092 fixed a bug
|
||||||
|
# in which 'podman build' would slurp up any input in the pipeline.
|
||||||
|
# Not a problem in a contrived example such as the one below, but
|
||||||
|
# definitely a problem when running commands in a pipeline to bash:
|
||||||
|
# all commands after 'podman build' would silently be ignored.
|
||||||
|
# In the test below, prior to #8092, the 'sed' would not get
|
||||||
|
# any input, and we would never see $random3 in the output.
|
||||||
|
# And, we use 'sed' to massage $random3 juuuuust on the remote
|
||||||
|
# chance that podman itself could pass stdin through.
|
||||||
|
results=$(echo $random3 | (
|
||||||
|
echo $random1
|
||||||
|
run_podman build -t build_test $tmpdir
|
||||||
|
sed -e 's/^/a/' -e 's/$/z/'
|
||||||
|
))
|
||||||
|
|
||||||
|
# First simple test: confirm that we see the piped-in string, as
|
||||||
|
# massaged by sed. This fails in 287edd4e2, the commit before #8092.
|
||||||
|
# We do this before the thorough test (below) because, should it
|
||||||
|
# fail, the diagnostic is much clearer and easier to understand.
|
||||||
|
is "$results" ".*a${random3}z" "stdin remains after podman-build"
|
||||||
|
|
||||||
|
# More thorough test: verify all the required strings in order.
|
||||||
|
# This is unlikely to fail, but it costs us nothing and could
|
||||||
|
# catch a regression somewhere else.
|
||||||
|
# FIXME: podman-remote output differs from local: #8342 (spurious ^M)
|
||||||
|
# FIXME: podman-remote output differs from local: #8343 (extra SHA output)
|
||||||
|
remote_extra=""
|
||||||
|
if is_remote; then remote_extra=".*";fi
|
||||||
|
expect="${random1}
|
||||||
|
.*
|
||||||
|
STEP 1: FROM $IMAGE
|
||||||
|
STEP 2: RUN echo x${random2}y
|
||||||
|
x${random2}y${remote_extra}
|
||||||
|
STEP 3: COMMIT build_test${remote_extra}
|
||||||
|
--> [0-9a-f]\{11\}
|
||||||
|
[0-9a-f]\{64\}
|
||||||
|
a${random3}z"
|
||||||
|
|
||||||
|
is "$results" "$expect" "Full output from 'podman build' pipeline"
|
||||||
|
|
||||||
|
run_podman rmi -f build_test
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function teardown() {
|
function teardown() {
|
||||||
# A timeout or other error in 'build' can leave behind stale images
|
# A timeout or other error in 'build' can leave behind stale images
|
||||||
# that podman can't even see and which will cascade into subsequent
|
# that podman can't even see and which will cascade into subsequent
|
||||||
|
@ -162,7 +162,8 @@ EOF
|
|||||||
myvol=myvol$(random_string)
|
myvol=myvol$(random_string)
|
||||||
rand=$(random_string)
|
rand=$(random_string)
|
||||||
|
|
||||||
run_podman run --rm -v $myvol:/myvol:z $IMAGE \
|
# Duplicate "-v" confirms #8307, fix for double-lock on same volume
|
||||||
|
run_podman run --rm -v $myvol:/myvol:z -v $myvol:/myvol2:z $IMAGE \
|
||||||
sh -c "echo $rand >/myvol/myfile"
|
sh -c "echo $rand >/myvol/myfile"
|
||||||
run_podman volume ls -q
|
run_podman volume ls -q
|
||||||
is "$output" "$myvol" "autocreated named container persists"
|
is "$output" "$myvol" "autocreated named container persists"
|
||||||
|
Reference in New Issue
Block a user