diff options
author | Ed Santiago <santiago@redhat.com> | 2020-09-29 10:56:40 -0600 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2020-09-29 10:56:40 -0600 |
commit | 81d9ba59db28dccf98c9faad8e337135ab8b0643 (patch) | |
tree | 16aabff3865962dc506cdb5ee0600593b6c40a2d /test/system | |
parent | 2ee415be90b8d6ab75f9fe579fc1b8690e023d3c (diff) | |
download | podman-81d9ba59db28dccf98c9faad8e337135ab8b0643.tar.gz podman-81d9ba59db28dccf98c9faad8e337135ab8b0643.tar.bz2 podman-81d9ba59db28dccf98c9faad8e337135ab8b0643.zip |
System tests: corner case for run --pull
Obscure corner case in which 'podman run --pull=never alpine'
will actually pass *with no alpine image* if there's an
image named "myalpine". (i.e. a substring match, not full
string match). Fixed in #7770 but the tests that were added
there do not actually test that.
This adds a double-duty test for that as well as making
sure that 'run --pull=never SHORTNAME' (implicit :latest)
does not match our existing :YYYYMMDD image; then one
more quick test to make sure that if we tag as :latest,
the same --pull=never succeeds.
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r-- | test/system/030-run.bats | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/test/system/030-run.bats b/test/system/030-run.bats index b3599cc17..813dd9266 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -153,8 +153,23 @@ echo $rand | 0 | $rand run_podman run --pull=always $NONLOCAL_IMAGE true is "$output" "Trying to pull .*" "--pull=always [with image PRESENT]: re-fetches" + # Very weird corner case fixed by #7770: 'podman run foo' will run 'myfoo' + # if it exists, because the string 'foo' appears in 'myfoo'. This test + # covers that, as well as making sure that our testimage (which is always + # tagged :YYYYMMDD, never :latest) doesn't match either. + run_podman tag $IMAGE my${PODMAN_TEST_IMAGE_NAME}:latest + run_podman 125 run --pull=never $PODMAN_TEST_IMAGE_NAME true + is "$output" "Error: unable to find a name and tag match for $PODMAN_TEST_IMAGE_NAME in repotags: no such image" \ + "podman run --pull=never with shortname (and implicit :latest)" + + # ...but if we add a :latest tag (without 'my'), it should now work + run_podman tag $IMAGE ${PODMAN_TEST_IMAGE_NAME}:latest + run_podman run --pull=never ${PODMAN_TEST_IMAGE_NAME} cat /home/podman/testimage-id + is "$output" "$PODMAN_TEST_IMAGE_TAG" \ + "podman run --pull=never, with shortname, succeeds if img is present" + run_podman rm -a - run_podman rmi $NONLOCAL_IMAGE + run_podman rmi $NONLOCAL_IMAGE {my,}${PODMAN_TEST_IMAGE_NAME}:latest } # 'run --rmi' deletes the image in the end unless it's used by another container |