mirror of
https://github.com/containers/podman.git
synced 2025-07-11 16:10:46 +08:00
test case added for image prune cache image
test case added for skipping cache images and fixed condition in test case for prune dangling image Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
This commit is contained in:
@ -87,7 +87,7 @@ var _ = Describe("Podman prune", func() {
|
|||||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman image prune none images", func() {
|
It("podman image prune skip cache images", func() {
|
||||||
SkipIfRemote()
|
SkipIfRemote()
|
||||||
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
|
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
|
||||||
|
|
||||||
@ -105,10 +105,35 @@ var _ = Describe("Podman prune", func() {
|
|||||||
after.WaitWithDefaultTimeout()
|
after.WaitWithDefaultTimeout()
|
||||||
Expect(none.ExitCode()).To(Equal(0))
|
Expect(none.ExitCode()).To(Equal(0))
|
||||||
hasNoneAfter, _ := after.GrepString("<none>")
|
hasNoneAfter, _ := after.GrepString("<none>")
|
||||||
Expect(hasNoneAfter).To(BeFalse())
|
Expect(hasNoneAfter).To(BeTrue())
|
||||||
Expect(len(after.OutputToStringArray()) > 1).To(BeTrue())
|
Expect(len(after.OutputToStringArray()) > 1).To(BeTrue())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("podman image prune dangling images", func() {
|
||||||
|
SkipIfRemote()
|
||||||
|
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
|
||||||
|
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
|
||||||
|
|
||||||
|
none := podmanTest.Podman([]string{"images", "-a"})
|
||||||
|
none.WaitWithDefaultTimeout()
|
||||||
|
Expect(none.ExitCode()).To(Equal(0))
|
||||||
|
hasNone, result := none.GrepString("<none>")
|
||||||
|
Expect(len(result)).To(Equal(2))
|
||||||
|
Expect(hasNone).To(BeTrue())
|
||||||
|
|
||||||
|
prune := podmanTest.Podman([]string{"image", "prune", "-f"})
|
||||||
|
prune.WaitWithDefaultTimeout()
|
||||||
|
Expect(prune.ExitCode()).To(Equal(0))
|
||||||
|
|
||||||
|
after := podmanTest.Podman([]string{"images", "-a"})
|
||||||
|
after.WaitWithDefaultTimeout()
|
||||||
|
Expect(none.ExitCode()).To(Equal(0))
|
||||||
|
hasNoneAfter, result := none.GrepString("<none>")
|
||||||
|
Expect(hasNoneAfter).To(BeTrue())
|
||||||
|
Expect(len(after.OutputToStringArray()) > 1).To(BeTrue())
|
||||||
|
Expect(len(result) > 0).To(BeTrue())
|
||||||
|
})
|
||||||
|
|
||||||
It("podman image prune unused images", func() {
|
It("podman image prune unused images", func() {
|
||||||
podmanTest.RestoreAllArtifacts()
|
podmanTest.RestoreAllArtifacts()
|
||||||
prune := podmanTest.PodmanNoCache([]string{"image", "prune", "-af"})
|
prune := podmanTest.PodmanNoCache([]string{"image", "prune", "-af"})
|
||||||
|
Reference in New Issue
Block a user