You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure how many of those gotchas can be detected through static analysis.
Not mentioned there (but probably should be):
It(func(ctx context.Context) {
// Should pass ctx!
Eventually(func() {
// Should not use ctx from It, but rather from func(ctx context.Context) { ... }
... Get(ctx, ...)
}).Should(...)
})
Describe the solution you'd like
Optional: require that Ginkgo callbacks take a context if the callback needs a context (i.e. has a context.TODO or context.Background or calls gomega.Eventually/Consistently)
Optional: require that gomega.Eventually/Consistently are called with a context (whether it is as first parameter or through WithContext (I think there is such a thing...)
Always: if gomega.Eventually/Consistently is called with a context, then it's callback should also accept a context if it needs one.
The text was updated successfully, but these errors were encountered:
Another one who likes to shoot his own context feet. Yes, checking that if a context is used inside a function passed to Eventually should take the context from the function, not the closure; cherry on top: kick the stupid dev forgetting to pass the context into Eventually using WithContext...
Is your feature request related to a problem? Please describe.
In Kubernetes, we encourage writing tests so that each
It
callback gets a context from Ginkgo and then passed that context on togomega.Eventually/Consistently
. This is easy to get wrong, so we have instructions: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/writing-good-e2e-tests.md#interrupting-testsI am not sure how many of those gotchas can be detected through static analysis.
Not mentioned there (but probably should be):
Describe the solution you'd like
gomega.Eventually/Consistently
are called with a context (whether it is as first parameter or throughWithContext
(I think there is such a thing...)The text was updated successfully, but these errors were encountered: