From bc1ed07b561e8fae8ef3456a5e2080dd9ff7c00f Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 13 Apr 2023 17:42:22 +0200 Subject: [PATCH] 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 --- test/e2e/common_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go index d2a90000b7..b6926e6706 100644 --- a/test/e2e/common_test.go +++ b/test/e2e/common_test.go @@ -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"})