ginkgo: continue after failure in ordered container
When running specs in an ordered container, ginkgo aborts after the first test failure:
Spec skipped because an earlier spec in an ordered container failed
In my case, additional specs can run. I need them to run in a certain order not because there are dependencies between them (each spec is self-contained) but because it is more efficient (some setup code can get skipped) and some tests are more reliable when run first.
Is it possible to configure whether ordered containers fail fast?
Background
I am testing PMEM-CSI with ginkgo and started the migration to v2 there. I’m also helping with Kubernetes and csi-test, which need to be migrated first.
In PMEM-CSI, we have the problem that one of our dependencies, the Operator Lifecycle Manager (OLM) fails with random timeouts when the tests using it run after the test cluster has been used for a while. I don’t have a good explanation and clearly that shouldn’t happen. I suspect some performance degradation, but the only solution that I have found so far is to run the tests with OLM directly after bringing up a test cluster.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (14 by maintainers)
This hint allowed me to solve my problem in PMEM-CSI: I moved the
Describecalls from top-level into aContextand now they get executed in the order in which they are defined because--randomize-allis off.As far as I am concerned, this issue can be closed.
hey @dmytro-zakharov Ginkgo lets you make the following trade-off:
Build independent specs that can be parallelized and randomized. This is the recommended approach and avoids using
Orderedcontainers. You can amortize the cost of setup in a variety of ways (happy to dig into it further with you if interested) and by parallelizing your suite you can generally keep test performance reasonable.Build ordered specs that allow you to express more complex flows as distinct
Its. In effect, the specs in anOrderedcontainer behave like one largeIt(in fact, people used to write these as one largeItbut asking for aBeforeAllbecame a common refrain in the community so I introducedOrderedcontainers to help people break up their specs into more bite-sized chunks).Ginkgo’s opinion is that when a spec in an
Orderedcontainer fails the entire container is considered suspect and no subsequent specs will run. While I can imagine adding complexity to allow users to specify “but not this spec” I’m concerned that that will make the behavior ofOrderedcontainers even harder to reason about. My preference is to guide users to prefer independent specs over correlated specs and to useOrderedonly in the specific context it was intended for: breaking up large complexIts into smaller pieces to make the test a bit easier to read.