summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-11-15 12:38:40 +0100
committerGitHub <noreply@github.com>2020-11-15 12:38:40 +0100
commit9fa09a83b30c5d9300eb40b3d50b405153b37f7a (patch)
treeb94acbbe3111af3b574c8d8a43f6880039502231
parent4eb9c28433f8aa1827f844881efb1ae1d15b0860 (diff)
parenta4c24719445777292193fa2c7a325a1757096fdd (diff)
downloadpodman-9fa09a83b30c5d9300eb40b3d50b405153b37f7a.tar.gz
podman-9fa09a83b30c5d9300eb40b3d50b405153b37f7a.tar.bz2
podman-9fa09a83b30c5d9300eb40b3d50b405153b37f7a.zip
Merge pull request #8325 from edsantiago/bats
system tests: various
-rw-r--r--test/system/010-images.bats12
-rw-r--r--test/system/070-build.bats57
-rw-r--r--test/system/160-volumes.bats3
3 files changed, 69 insertions, 3 deletions
diff --git a/test/system/010-images.bats b/test/system/010-images.bats
index 900a24368..98bb0cc57 100644
--- a/test/system/010-images.bats
+++ b/test/system/010-images.bats
@@ -3,10 +3,18 @@
load helpers
@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"
+
+ # '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" {
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 064cad965..83bcd13eb 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -318,6 +318,63 @@ EOF
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() {
# A timeout or other error in 'build' can leave behind stale images
# that podman can't even see and which will cascade into subsequent
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index c19e61669..0b7aab2fb 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -162,7 +162,8 @@ EOF
myvol=myvol$(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"
run_podman volume ls -q
is "$output" "$myvol" "autocreated named container persists"