test/e2e: fix CleanupVolume/Secrets()

Just like Cleanup() they should check the error codes.
While doing this it was clear that some volume tests were calling
Cleanup() twice so remove this.

Instead make sure they call Cleanup() themselves so callers only need to
do one call. This is required because we cannot use Expect().To() before
doing all the cleanup. An error causes panic does results in an early
return thus missing potentially important cleanup.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-04-14 11:47:41 +02:00
parent bc1ed07b56
commit c5922cc6f0
4 changed files with 8 additions and 22 deletions

View File

@@ -58,8 +58,6 @@ var _ = Describe("Podman volume prune", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).To(HaveLen(2))
podmanTest.Cleanup()
})
It("podman prune volume --filter until", func() {
@@ -89,8 +87,6 @@ var _ = Describe("Podman volume prune", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})
It("podman prune volume --filter", func() {
@@ -157,8 +153,6 @@ var _ = Describe("Podman volume prune", func() {
session = podmanTest.Podman([]string{"volume", "prune", "--force", "--filter", "label!=testlabel"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
podmanTest.Cleanup()
})
It("podman system prune --volume", func() {
@@ -188,7 +182,5 @@ var _ = Describe("Podman volume prune", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).To(BeEmpty())
podmanTest.Cleanup()
})
})