mirror of
https://github.com/containers/podman
synced 2024-10-21 09:45:32 +00:00
0f7d54b026
Migrate the Podman code base over to `common/libimage` which replaces `libpod/image` and a lot of glue code entirely. Note that I tried to leave bread crumbs for changed tests. Miscellaneous changes: * Some errors yield different messages which required to alter some tests. * I fixed some pre-existing issues in the code. Others were marked as `//TODO`s to prevent the PR from exploding. * The `NamesHistory` of an image is returned as is from the storage. Previously, we did some filtering which I think is undesirable. Instead we should return the data as stored in the storage. * Touched handlers use the ABI interfaces where possible. * Local image resolution: previously Podman would match "foo" on "myfoo". This behaviour has been changed and Podman will now only match on repository boundaries such that "foo" would match "my/foo" but not "myfoo". I consider the old behaviour to be a bug, at the very least an exotic corner case. * Futhermore, "foo:none" does *not* resolve to a local image "foo" without tag anymore. It's a hill I am (almost) willing to die on. * `image prune` prints the IDs of pruned images. Previously, in some cases, the names were printed instead. The API clearly states ID, so we should stick to it. * Compat endpoint image removal with _force_ deletes the entire not only the specified tag. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
55 lines
1.5 KiB
Bash
55 lines
1.5 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load helpers
|
|
|
|
# helper function for "podman tag/untag" test
|
|
function _tag_and_check() {
|
|
local tag_as="$1"
|
|
local check_as="$2"
|
|
|
|
run_podman tag $IMAGE $tag_as
|
|
run_podman image exists $check_as
|
|
run_podman untag $IMAGE $check_as
|
|
run_podman 1 image exists $check_as
|
|
}
|
|
|
|
@test "podman tag/untag" {
|
|
# Test a fully-qualified image reference.
|
|
_tag_and_check registry.com/image:latest registry.com/image:latest
|
|
|
|
# Test a reference without tag and make sure ":latest" is appended.
|
|
_tag_and_check registry.com/image registry.com/image:latest
|
|
|
|
# Test a tagged short image and make sure "localhost/" is prepended.
|
|
_tag_and_check image:latest localhost/image:latest
|
|
|
|
# Test a short image without tag and make sure "localhost/" is
|
|
# prepended and ":latest" is appended.
|
|
_tag_and_check image localhost/image:latest
|
|
|
|
# Test error case.
|
|
run_podman 125 untag $IMAGE registry.com/foo:bar
|
|
is "$output" "Error: registry.com/foo:bar: tag not known"
|
|
}
|
|
|
|
@test "podman untag all" {
|
|
# First get the image ID
|
|
run_podman inspect --format '{{.ID}}' $IMAGE
|
|
iid=$output
|
|
|
|
# Add a couple of tags
|
|
run_podman tag $IMAGE registry.com/1:latest registry.com/2:latest registry.com/3:latest
|
|
|
|
# Untag with arguments to for all tags to be removed
|
|
run_podman untag $iid
|
|
|
|
# Now make sure all tags are removed
|
|
run_podman image inspect $iid --format "{{.RepoTags}}"
|
|
is "$output" "\[\]" "untag by ID leaves empty set of tags"
|
|
|
|
# Restore image
|
|
run_podman tag $iid $IMAGE
|
|
}
|
|
|
|
# vim: filetype=sh
|