test: simplify cleanup code

do not try to first stop and then rm but combine the two operations in
a single command.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2022-05-10 13:23:04 +02:00
parent 28588235d2
commit d0ca90b3ed

View File

@ -516,17 +516,13 @@ func (p *PodmanTestIntegration) PodmanPID(args []string) (*PodmanSessionIntegrat
// Cleanup cleans up the temporary store
func (p *PodmanTestIntegration) Cleanup() {
// Remove all containers
stopall := p.Podman([]string{"stop", "-a", "--time", "0"})
stopall.WaitWithDefaultTimeout()
podstop := p.Podman([]string{"pod", "stop", "-a", "-t", "0"})
podstop.WaitWithDefaultTimeout()
podrm := p.Podman([]string{"pod", "rm", "-fa"})
// Remove all pods...
podrm := p.Podman([]string{"pod", "rm", "-fa", "-t", "0"})
podrm.WaitWithDefaultTimeout()
session := p.Podman([]string{"rm", "-fa"})
session.WaitWithDefaultTimeout()
// ...and containers
rmall := p.Podman([]string{"rm", "-fa", "-t", "0"})
rmall.WaitWithDefaultTimeout()
p.StopRemoteService()
// Nuke tempdir