-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
[QUESTION] Ginkgo parallel specs using go routines. #1263
Comments
hi there - in general i recommend against trying to orchestrate specs in parallel with goroutines the way you are trying to do. A lot of Ginkgo's assumptions are broken when you launch a goroutine that outlives the lifecycle of the I don't know if you're working on a Kubernetes-related test suite but I've been noticing more and more folks working in that context trying to implement the pattern you are asking for and I recently shared an overview of what Ginkgo expects and doesn't support very well right now. In your particular case - it sounds like you have (a) some setup, (b) some tests that depend on that setup which must wait until that setup completes, (c) some tests that don't depend on that setup. Ordinarily I would run these tests like this: Describe("my tests", func() {
Describe("tests that require shared setup", func() {
var client *MyClient
BeforeEach(func() {
client = PerformSetup()
})
It("tests something that relies on the setup", func() {
//do stuff with client and make assertions
})
It("tests something else that relies on the setup", func() {
//do other stuff with client and make assertions
})
})
It("some other test that is independent", func() {
//...
})
}) When you run this suite with Sometimes repeating setup like this is too costly (though I strongly recommend actually running in parallel to see if that is the case for you!). For such usecases Ginkgo 2.0 released Describe("my tests", func() {
Describe("tests that require shared setup", Ordered, func() {
var client *MyClient
BeforeAll(func() {
client = PerformSetup()
})
It("tests something that relies on the setup", func() {
//do stuff with client and make assertions
})
It("tests something else that relies on the setup", func() {
//do other stuff with client and make assertions
})
})
It("some other test that is independent", func() {
//...
})
}) Now when you run the suite with So, concretely, I would suggest: (a) try repeating the setup with |
I am new to ginkgo and wanted some help. I have few specs which are interdependent hence I'm running them in a ordered execution strategy. Now I want to speed it up and run them in parallel but since ginkgo does not prefer interdependency I have to make a lot of tweaks making it parallel. So instead I am using go routines to achieve something similar. However It will not be returning correct execution time for each spec i.e logs are incorrect. I need help in finding some other alternative way or finding some workaround in the current way.
In Below Scenario:
Some test 2 is dependent on setup to complete however Some test can run meanwhile. I am able to achieve that here but this solution is not correct. Overall run time is correct i.e around 10 seconds. However individual subject nodes are giving wrong execution time (which is expected ) and I want to fix that.
Sample code:
Thanks
The text was updated successfully, but these errors were encountered: