-
-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for BeforeAll
in unordered containers
#1211
Comments
hey @tbrisker - this is something i'm considering. I appreciate there are some cases where a set of specs are independent save for some shared reusable setup and teardown that is too expensive to perform for each spec. Such specs can be randomized and parallelized. There is some degree of complexity here - akin to the complexity that led to the development of Requiring None of this is to say I'm not open to solving for this problem. Just that there is some complexity here and I can imagine some of the future issues that users will open when they bump into these things! Another consideration is whether the current imperative model (do this setup I'm happy to continue the conversation here with anyone who's interested. To be transparent: with the kids out of school soon I'm unlikely to get to this until the fall - so there's time to think about approaches. |
A @tbrisker have you looked at |
@onsi I appreciate the deep explanation, I'm sure it isn't a trivial thing to implement. Unfortunately I'm not familiar enough with the internals of ginkgo to be able to suggest how to approach it or propose a fix myself. @ebabani thanks, we have test suites which run hundreds of tests grouped in multiple containers according to domains, we do have |
no worries, @tbrisker - rather than dive too deep into solutions together I think it would be most helpful for me to continue to explore the problem so that I can wrap my head around if/what would make sense to implement.
Those are interesting facts. Some questions:
No doubt I'll come up with more - but it would be helpful to understand the contours of the problem in some more detail so I can wrap my head around it. There may be solutions that are in reach today. |
At the moment we don't run them in parallel at all, as they weren't written with parallelism in mind (e.g. some global state that is not thread-safe). It's a long term goal to get there in the future.
The majority of the specs that use
In some cases we're using Ordered+BeforeAll, in others we take the hit of Before/AfterEach for every spec.
This might cause unexpected results in other groups, I think it depends on the specific case. Also, for some it would mean longer time some resources exists could cause quota or cost issues (e.g. cloud resources)
Long-term, that would be beneficial, though we still have quite a bit of work before we get there. Short-term, this is more about enabling some common setup to be reused for all relevant specs instead of repeated creation+deletion for every spec without requiring them to be ordered. We can live (and have been) with ordered tests, but it's causing confusion wrt the intent (i.e. the group being marked as ordered despite the order not actually being relevant), and also prevents randomizing the spec order and caused the whole group to fail if one of the specs fail (although this has been solved by |
We're facing similar problems as described where we currently use k8s.io/kubernetes package in our tests which uses |
In case there's interest, please take a look at the new proposal for managing shared resources and having finer-grained control over parallelism here: #1292 |
In certain cases, there is some setup which needs to be done for a container and is used for all specs in that container.
Right now the options are either marking that container as
Ordered
, which prevents parallelizing or randomizing the container specs, or running the setup inBeforeEach
which will cause it to run once for every spec. In some casesBeforeEach
is not a good option, e.g. when the setup takes non-trivial time to run or requires some resources from external systems.Please add support for defining
BeforeAll
/AfterAll
blocks for non-ordered containers.The text was updated successfully, but these errors were encountered: