-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Flapping test failure #126
Comments
Actually here are the ducks:
So duck 11 and 12 should be in Pond 1. The test should work all the time, but for some reason sometimes there are 2 extra ducks in the expected set. |
Ok, solved this one: Simply calling:
won't retrieve ducks in a determinate way on postgresql. We need to specify an order (and a pond). I've added the fix in my current PR to keep things together. I hope that's ok. |
@brendon wow great hunting. Why does the query not deterministically return the appropriate ducks? The code doesn't look to have any non-deterministic characteristics? |
I think it's because we're grabbing the first 50 ducks and updating them, which may move them around on disk. The Postgresql docs state:
Most databases return what we'd expect, but I guess Postgresql uses the non-determinism to its advantage in the way it stores things? Hard to say for sure :) |
Wow. So even a sort by |
Haha! Yea I didn't think of that. Either one probably fits in with the spirit of the test :) Just quickly before we walk away from this one: How come you're doing this?
vs
or
|
Here's the test:
I've tried to reason this one out. It looks like you create two ponds of ducks (0 and 1). 10% of the ducks will be in Pond 1. The age of the ducks in Pond 1 will always equal 0 for the initial
update_attributes
.You then grab duck 11 and 12 which could conceivably be in either Pond 1 or 0 depending on how the rankings were reshuffled. You then get a result that excludes these two ducks, and add the two ducks to the end of the list.
We then compare Pond 1 members with the original members that have had duck 11 and 12 added.
@ordered[0..-2] + [@ordered[-1]
. Isn't that the same as:@ordered[0..-1]
?This could probably be most easily fixed by just making sure duck 11 and 12 are from Pond 1. I'll have a play.
The text was updated successfully, but these errors were encountered: