ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Long-running BeforeAll looks like the first It block takes a long time

Open LittleFox94 opened this issue 3 years ago • 2 comments

Hi,

as said in #933, we do integration tests for API bindings with Ginkgo and Gomega. I'm currently writing the tests for one such API binding which needs a resource of another one. I currently create that resource in BeforeAll, cleaning it up in AfterAll (Before/AfterSuite might be better, but I guess that's not relevant? Didn't check that though).

These operation can take quite some time (sadly) and the output looks a bit confusing (I add slashes to show nesting of Describe, Context and co):

ginkgo run -tags integration -v ./pkg/apis/ipam/v1/
Running Suite: test suite for IPAM API definition - /home/mara/src/github.com/anexia-it/go-anxcloud/pkg/apis/ipam/v1
====================================================================================================================
Random Seed: 1645530004

Will run 12 of 40 specs (XXX: had a focus in the flags)
SSSSSSSSSSSSSSSSSSSSSSSSSSSS
------------------------------
IPAM E2E tests / with a VLAN created for testing / working with private IPv4
  creates a prefix
  /home/mara/src/github.com/anexia-it/go-anxcloud/pkg/apis/ipam/v1/e2e_test.go:80

it's stuck at that for some time and it's actually creating that other resource (VLAN). I would have expected something like this:

IPAM E2E tests / with a VLAN created for testing
  BeforeAll
  /file/path/and/line/where/the/BeforeAll/is/defined.go:42

If this is confusing, I'm happy to make a minimum example :)

LittleFox94 avatar Feb 22 '22 11:02 LittleFox94

hey @LittleFox94 this makes sense and it's an unfortunate side effect of the reality that the BeforeAll node runs as part of the first It node and not as a standalone thing with it's own report. I appreciate that it's confusing but I don't think it's something I'm going to be able to change any time soon.

onsi avatar Mar 14 '22 15:03 onsi

could adding a line be possible, making it look like this? This could probably already help a lot

ginkgo run -tags integration -v ./pkg/apis/ipam/v1/
Running Suite: test suite for IPAM API definition - /home/mara/src/github.com/anexia-it/go-anxcloud/pkg/apis/ipam/v1
====================================================================================================================
Random Seed: 1645530004

Will run 12 of 40 specs (XXX: had a focus in the flags)
SSSSSSSSSSSSSSSSSSSSSSSSSSSS
------------------------------
IPAM E2E tests / with a VLAN created for testing / working with private IPv4
  creates a prefix
  /home/mara/src/github.com/anexia-it/go-anxcloud/pkg/apis/ipam/v1/e2e_test.go:80
  currently running BeforeAll .... done

Replace the BeforeAll with whatever it's currently running (BeforeAll, BeforeEach, JustBeforeEach, ..) and maybe only after two seconds so it's not spamming the log

LittleFox94 avatar Mar 16 '22 11:03 LittleFox94

As of ginkgo 2.5 you can run

ginkgo -v -show-node-events to see exactly which node is running. I think that can help cases like this.

am going to close this out for now.

onsi avatar Nov 16 '22 03:11 onsi