diff options
author | Ed Santiago <santiago@redhat.com> | 2020-02-19 13:30:12 -0700 |
---|---|---|
committer | Ed Santiago <santiago@redhat.com> | 2020-02-20 07:55:29 -0700 |
commit | 29930fae702ee5aea62353a14dce26d5e93a27db (patch) | |
tree | cdfe26d898e6eee8f354e0ca2f0aa76b41ced437 /test/system/010-images.bats | |
parent | 126f75d7be3353c2df7ed1c3f9c6e0a7b707422e (diff) | |
download | podman-29930fae702ee5aea62353a14dce26d5e93a27db.tar.gz podman-29930fae702ee5aea62353a14dce26d5e93a27db.tar.bz2 podman-29930fae702ee5aea62353a14dce26d5e93a27db.zip |
podman images: add --filter=since=XX
Looks like a bit of a misunderstanding from early on.
Docker implements --filter=since=IMAGE. Podman implements 'after'
instead of 'since'. Add an equivalent case statement to handle
both, keeping 'after' because we have no way of knowing if it
is used in the field.
Update documentation ... and fix what looks like a complete
misinterpretation of what the code actually does: the man page
claimed that these were time fields, but I don't see any
possible incantation in which a time value works or could
work. Updated docs to reflect IMAGE usage. Also changed
nonworking '==' to single '='.
Added tests. [UPDATE: skip with broken podman-remote]
Fixes: #5040
Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/010-images.bats')
-rw-r--r-- | test/system/010-images.bats | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/system/010-images.bats b/test/system/010-images.bats index 66ef53590..3224c9b42 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -74,4 +74,40 @@ size | [0-9]\\\+ run_podman rm my-container } +@test "podman images - filter" { + skip_if_remote "podman commit -q is broken in podman-remote" + + run_podman inspect --format '{{.ID}}' $IMAGE + iid=$output + + run_podman images --noheading --filter=after=$iid + is "$output" "" "baseline: empty results from filter (after)" + + run_podman images --noheading --filter=before=$iid + is "$output" "" "baseline: empty results from filter (before)" + + # Create a dummy container, then commit that as an image. We will + # now be able to use before/after/since queries + run_podman run --name mytinycontainer $IMAGE true + run_podman commit -q mytinycontainer mynewimage + new_iid=$output + + # (refactor common options for legibility) + opts='--noheading --no-trunc --format={{.ID}}--{{.Repository}}:{{.Tag}}' + + run_podman images ${opts} --filter=after=$iid + is "$output" "sha256:$new_iid--localhost/mynewimage:latest" "filter: after" + + # Same thing, with 'since' instead of 'after' + run_podman images ${opts} --filter=since=$iid + is "$output" "sha256:$new_iid--localhost/mynewimage:latest" "filter: since" + + run_podman images ${opts} --filter=before=mynewimage + is "$output" "sha256:$iid--$IMAGE" "filter: before" + + # Clean up + run_podman rmi mynewimage + run_podman rm mytinycontainer +} + # vim: filetype=sh |