test_include_query(EagerLoadPolyAssocsTest) fails for test_mysql when auto_increment_increment != 1 [PATCH] [#825]

I found a problem in
activerecord/test/cases/associations/eager_load_nested_include_test.rb
where the test is dependent upon the id values assigned to the test
data

In my case, my MySQL my.cnf had an auto_increment_increment value of
5, so the created records did not have sequential ids (and so the test
failed and rake tests did not all pass)

I have submitted a patch on lighthouse that removes the dependency on
the id values

Hopefully, this can get merged to core soon

Cheers.

--Brent

Here's a link to the ticket... http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/825

Anyone else running MySQL with auto_increment_increment set to
anything other than 1, please help by (reproducing the problem and)
testing the patch please.

Anyone out there able to test this? Seems kind of important to be able
to run the tests successfully without reconfiguring mysql...

Help! Please?

Anyone out there able to test this? Seems kind of important to be able
to run the tests successfully without reconfiguring mysql...

Help! Please?

Hi there,

I think the gist of this fix is great, just a few comments:

* You should probably hold the objects, not the ids in the class arrays.
* You could use after_saves to do the storing
* You could encapsulate the 'get a random one of these' with Foo.random

Other than that it looks good. Tests relying on the ids is a bit of a smell.

Out of interest, why do you need to change that setting?

I think the gist of this fix is great, just a few comments:

* You should probably hold the objects, not the ids in the class arrays.
* You could use after_saves to do the storing
* You could encapsulate the 'get a random one of these' with Foo.random

Cool. I will look at cleaning that up and attach a new patch to the
ticket.

Other than that it looks good. Tests relying on the ids is a bit of a smell.

Thanks, and yes, that's what I thought.

Out of interest, why do you need to change that setting?

My development environment matches the production environment for one
of my clients. On that system, I'm running a BackgrounDRb task to
synchronize the contents of tables in a MySQL database with the
contents of a legacy database via ODBC. Since records can be created
on both systems we use an increment of 5 paired with a different
starting offset (1 on the legacy system and 2 in MySQL) to guarantee
unique ids (e.g. ids would be 1, 6, 11... on the legacy system and 2,
7, 12... on MySQL ).

Cheers.

* You should probably hold the objects, not the ids in the class arrays.
* You could use after_saves to do the storing
* You could encapsulate the 'get a random one of these' with Foo.random

Done.

Please see the ticket... http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/825