tests/podman: podman rmi output check#4104
Conversation
|
Hi @nbspsemicolon. Thanks for your PR. I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| c.MustSSH(m, cmd) | ||
|
|
||
| cmd = fmt.Sprintf("sudo podman images | grep %s", imageID) | ||
| cmd = fmt.Sprintf("sudo podman images --noheading --format={{.ID}} --filter reference=%s", image) |
There was a problem hiding this comment.
I think maybe this isn't quite sufficient because I think it will return the same thing whether the image is there or not.
[dustymabe@media ~]$ image=localhost/fedora-bootc:latest
[dustymabe@media ~]$ podman images --noheading --format={{.ID}} --filter reference="${image}"
66781fe007f4
[dustymabe@media ~]$ podman rmi "${image}"
Untagged: localhost/fedora-bootc:latest
Deleted: 66781fe007f49a100cd791004ad86058c5249e4a59cb1d5f0fa7d17e503651d7
Deleted: 2ca322d51d9b382b7eba7dee359f50cc107c3f0465a6961137924a7bcc1d6833
Deleted: 7cc1db48af1018e2b25539d2bc863601223bb368d95662112df6b8d4bce550f7
Deleted: 196bb6c5b4e1cb617e9ebe9b06fb32eac3bfb2aebc5dcfb66e5987052491138e
Deleted: ef92ce00f8ee7c4366cd8163216b935f9eb610a9a976d9479cec4c030614c8aa
Deleted: ad70b34a589e7e94250b7b89a5e15341684e04f94c98ffd8d81f45c68589aa16
Deleted: a6f0f87bbaf5799a6b1cb5a407c61eace3316a0ff7bc31271fd42c68d597f9bb
[dustymabe@media ~]$ podman images --noheading --format={{.ID}} --filter reference="${image}"
[dustymabe@media ~]$ echo $?
0
In both cases (when the image was there or wasn't) podman images --noheading --format={{.ID}} --filter reference="${image}" gave a success exit code, so the code here won't really verify the image no longer exists.
I think maybe something like this might be a better check:
[dustymabe@media ~]$ podman image exists --help
Check if an image exists in local storage
Description:
If the named image exists in local storage, podman image exists exits with 0, otherwise the exit code will be 1.
Usage:
podman image exists IMAGE
Examples:
podman image exists ID
podman image exists IMAGE && podman pull IMAGE
[dustymabe@media ~]$ podman image exists "${image}"
[dustymabe@media ~]$ echo $?
1
There was a problem hiding this comment.
I switched out "images" with "image exists" and tested the error code. "image exists" does indeed return the error code as needed. pr code updated
| cmd = fmt.Sprintf("sudo podman image exists %s", image) | ||
| out, err := c.SSH(m, cmd) | ||
| if err == nil { | ||
| if err != nil { |
There was a problem hiding this comment.
image exists will return success if it found the image, which in this case would be an error.
| if err != nil { | |
| if err == nil { |
There was a problem hiding this comment.
Missed this earlier. Going to squash this in as well.
|
can you squash the commits into 1? |
0229d36 to
55381b2
Compare
podman rmi only produces two lines of output without a -q option that might produce a "docker-ish" output displaying only the abbreviated image ID. To simplify rmi success checking, indirect testing using the expected ID output was replaced with a direct reference to the image name. Bash piping with grep was also removed in favor of a single command.
55381b2 to
231ebb6
Compare
|
/ok-to-test |
podman rmi only produces two lines of output without a -q option that might produce a "docker-ish" output displaying only the abbreviated image ID.
To simplify rmi success checking, indirect testing using the expected ID output was replaced with a direct reference to the image name. Bash piping with grep was also removed in favor of a single command.