-
-
Notifications
You must be signed in to change notification settings - Fork 650
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
Flaky asynchronous test fails with wrong spec state #465
Comments
This test is failing on the following line: https://github.com/onsi/ginkgo/blob/master/internal/leafnodes/shared_runner_test.go#L220 If we look at the spec states (https://github.com/onsi/ginkgo/blob/master/types/types.go#L144-L145) we are expecting a state of timeout but instead get one of panicked. Looking back at the test we can see there is a panic: https://github.com/onsi/ginkgo/blob/master/internal/leafnodes/shared_runner_test.go#L212 If I was a betting man I'd say that it's likely on a constrained test environment, regardless of whether we timeout or not, there's probably a race in the This can be reproduced with two extra lines:
Effectively what this means is that we would set the spec status to timedout, and then just before we drain that status, the panic fires, triggering the defer block and setting the status to panicked. |
@williammartin I am not sure I have understood your point. Where would you put the sleep exactly? A possible the root cause (maybe different from the one above) is the too narrow difference in time between the timeout (set to 10ms) and the sleep in the async func (set to 20ms) Suppose that there is a sleep long enough before the However, is it possible that this sleep would happen? 🤔 |
@williammartin any thoughts on the comment above? |
Yes but I thought we could discuss when you're back. Not the easiest to describe racy behaviour over GitHub. |
The tests was occasionally failing due to a race between the goroutine waiting for a timeout and the goroutine setting the test state. This commit changes the test so that it does not close the channel in time, so that the chance of flakiness is significantely reduced. Fixes #465 Co-authored-by: William Martin <wmartin@pivotal.io>
Occasionally when I run the ginkgo tests I see the following failure:
The text was updated successfully, but these errors were encountered: