Skip to content
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

Fix flaky test in HasManyThroughDisableJoinsAssociationsTest #43649

Merged
merged 1 commit into from Nov 15, 2021

Conversation

DmitryTsepelev
Copy link
Contributor

Summary

While working on #38957 I got the HasManyThroughDisableJoinsAssociationsTest#test_to_a_on_disable_joins_with_multiple_scopes sometimes failing in PSQL suite, which's weird since I do not even touch AR:

Failure:
HasManyThroughDisableJoinsAssociationsTest#test_to_a_on_disable_joins_with_multiple_scopes [/rails/activerecord/test/cases/associations/has_many_through_disable_joins_associations_test.rb:124]:
--- expected
+++ actual
@@ -1 +1 @@
-[#<Rating id: 6, comment_id: 16, value: 8>, #<Rating id: 7, comment_id: 16, value: 9>]
+[#<Rating id: 7, comment_id: 16, value: 9>, #<Rating id: 6, comment_id: 16, value: 8>]

PostgreSQL does not guarantee the order of records and we never specify it. I wonder if adding an explicit order is fine or it makes the spec itself wrong.

Copy link
Member

@gmcgibbon gmcgibbon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

de6b4ef, https://buildkite.com/rails/rails/builds/82494#e482cf73-ee6a-42eb-9efa-13c04d84cc14

I believe the assertion is related to query count more than order. LGTM 👍

@gmcgibbon gmcgibbon merged commit 1c2468f into rails:main Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants