Skip to content

Loading…

ActiveRecord 3.2.10 test suite error #8724

Closed
voxik opened this Issue · 11 comments

4 participants

@voxik

I am observing strange error when trying to update active record in Fedora Rawhide:

$ ruby -I.:test:lib test/cases/associations/nested_through_associations_test.rb

*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`.

Using sqlite3 with Identity Map off
Run options: 

# Running tests:

.F.........F.............................................

Finished tests in 1.205003s, 47.3028 tests/s, 132.7797 assertions/s.

  1) Failure:
test_distinct_has_many_through_a_has_many_through_association_on_through_reflection(NestedThroughAssociationsTest) [test/cases/associations/nested_through_associations_test.rb:393]:
<[#<Subscriber nick: "alterself", name: "Luke Holden", books_count: 0>,
 #<Subscriber nick: "webster132", name: "David Heinemeier Hansson", books_count: 0>]> expected but was
<[#<Subscriber nick: "webster132", name: "David Heinemeier Hansson", books_count: 0>, #<Subscriber nick: "alterself", name: "Luke Holden", books_count: 0>]>.

  2) Failure:
test_has_many_through_has_many_through_with_has_many_source_reflection(NestedThroughAssociationsTest) [test/cases/associations/nested_through_associations_test.rb:82]:
<[#<Subscriber nick: "alterself", name: "Luke Holden", books_count: 0>,
 #<Subscriber nick: "webster132", name: "David Heinemeier Hansson", books_count: 0>,
 #<Subscriber nick: "webster132", name: "David Heinemeier Hansson", books_count: 0>]> expected but was
<[#<Subscriber nick: "webster132", name: "David Heinemeier Hansson", books_count: 0>, #<Subscriber nick: "webster132", name: "David Heinemeier Hansson", books_count: 0>, #<Subscriber nick: "alterself", name: "Luke Holden", books_count: 0>]>.

57 tests, 160 assertions, 2 failures, 0 errors, 0 skips

Although the records are returned correctly, they are not ordered for some reason, although they should be according to the code.

My environment is:

$ ruby -v
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]
$ gem list

*** LOCAL GEMS ***

activemodel (3.2.10)
activesupport (3.2.10)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bigdecimal (1.1.0)
builder (3.1.4)
erubis (2.7.0)
i18n (0.6.1)
io-console (0.3)
json (1.7.5)
metaclass (0.0.1)
minitest (4.2.0)
mocha (0.13.1)
multi_json (1.3.6)
rack (1.4.1)
rdoc (3.12)
sqlite3 (1.3.5)
tzinfo (0.3.34)
$ rpm -q sqlite
sqlite-3.7.15-1.fc19.x86_64

Any help is appreciated. Thank you

@robin850
Ruby on Rails member
@rafaelfranca
Ruby on Rails member

I'm getting this too, but it is not related to any version of rails, you will see the same failures on the master branch. It is something related with the machine. As you can see the travis build is green.

@voxik

@rafaelfranca you are right, since I did the same test for rails 3.2.{8,9} and it failed the same.

@acapilleri

I confirm it, but I have the warning also.

@rafaelfranca
Ruby on Rails member

It is something with sqlite 3.7.15, maybe is some bug on it

@voxik

I can confirm that the test passes with older sqlite:

$ rpm -q sqlite
sqlite-3.7.14.1-1.fc19.x86_64
$ ruby -I.:test:lib test/cases/associations/nested_through_associations_test.rb

*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`.

Using sqlite3 with Identity Map off
Run options: 

# Running tests:

.........................................................

Finished tests in 1.132622s, 50.3257 tests/s, 141.2651 assertions/s.

57 tests, 160 assertions, 0 failures, 0 errors, 0 skips
@voxik

Hmm, I see this entry in Sqlite release log:

Enhance the query optimizer so that ORDER BY clauses are more aggressively optimized, especially in joins where various terms of the ORDER BY clause come from separate tables of the join.

I wouldn't be surprised if that is related to this issue.

@voxik

This was fixed in sqlite 3.7.15.2 as pointed-out at https://bugzilla.redhat.com/show_bug.cgi?id=891865

Here are some additional references:

http://www.mail-archive.com/sqlite-users@sqlite.org/msg74717.html
http://www.sqlite.org/releaselog/3_7_15_2.html

Not sure if sqlite prior 3.7.15.2 can be banned by AR somehow.

@rafaelfranca
Ruby on Rails member

We can't change the requirement for sqlite because of a regression bug in the database.

Thank you for the update.

Closing this now.

@voxik

@rafaelfranca This should be at least documented somewhere as known issue. It quite unfortunate if somebody will have to fight this bug again. You should care about your external dependencies.

@rafaelfranca
Ruby on Rails member

It is documented now on this issue tracker. As it is a patch release of squlite I doubt people will have this issue in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.