ginkgo v2: fix new Skip() behavior

It looks like AfterEach() is now executed even after Skip(), this is a
good idea because the fact that it did't before caused us to leak tmp
directories. However in case Skip() is called before the podmanTest is
initialized it will no result in a panic. To fix it simply prevent such
panic by checking the pointer against nil and do nothing in such case.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-04-13 17:42:22 +02:00
parent cd46e72795
commit bc1ed07b56

View File

@ -569,6 +569,12 @@ func (p *PodmanTestIntegration) Quadlet(args []string, sourceDir string) *Podman
// Cleanup cleans up the temporary store
func (p *PodmanTestIntegration) Cleanup() {
// ginkgo v2 still goes into AfterEach() when Skip() was called,
// some tests call skip before the podman test is initialized.
if p == nil {
return
}
// first stop everything, rm -fa is unreliable
// https://github.com/containers/podman/issues/18180
stop := p.Podman([]string{"stop", "--all", "-t", "0"})