-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 specs in score calculator: FloatDomainError: NaN #3325
Comments
These tests haven't failed for months and I can't reproduce them locally. For now I'll assume the problem is solved by either commit db6ed47 (which fixes potential issues when freezing time), pull request #3564 (which changes code related to settings), or any other changes we've done in the last few months. This is just a guess, so feel free to reopen if they fail again. |
Failed again in Build 31193, job 3. I've updated the issue. |
Failure
Travis failed builds:
Messages:
Another similar error:
And another one:
And another one more:
Cause
The failure is caused by a division by zero. In some tests, the numerator is also
0.0
, causing aNaN
error, and in some other tests, the numerator is another number, causing anInfinity
error.The lines causing the
period
to be zero are:The tests fail because sometimes
Time.current - resource.created_at
returns a negative value.Debugging process
The following test might reproduce the failure if run enough times (while debugging it failed about once every 500 attempts on Travis):
After adding some code to debug the failure:
We've found out these results in some failures:
Further debugging in javierm's build 529 showing the exact time (converting
created_at.to_f
) debates and comments are created during the failure:Si it looks like between the moment the debate is created and the moment the comment is created, the system goes back in time a couple of tenths of a second.
The text was updated successfully, but these errors were encountered: