ginkgo
ginkgo copied to clipboard
Long-running BeforeAll looks like the first It block takes a long time
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 :)
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.
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
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.