https://www.chiliproject.org/2011-02-10T17:45:46+01:00ChiliProjectChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=98722011-02-10T17:45:46+01:00Gregor Schmidtschmidt@nach-vorne.eu
<ul><li><strong>Start date</strong> set to <i>2011-02-10</i></li><li><strong>Estimated time</strong> deleted ()</li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>Normal</i></li><li><strong>Project</strong> set to <i>ChiliProject</i></li><li><strong>Target version</strong> set to <i>1.1.0 — Bell</i></li><li><strong>Assignee</strong> set to <i>Eric Davis</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>0</i></li><li><strong>Subject</strong> set to <i>unit/user_test.rb:138 fails with mysql2 gem</i></li><li><strong>Category</strong> set to <i>Testing</i></li><li><strong>Tracker</strong> set to <i>Bug</i></li><li><strong>Due date</strong> deleted ()</li><li><strong>Subproject of</strong> deleted ()</li><li><strong>Description</strong> set to <i>I'm seeing the following error when running @rake test:units@
<pre>...</i> <a href="/journals/9872/diff/description" class="lightbox-ajax">More</a></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=9552011-02-10T17:52:29+01:00Gregor Schmidtschmidt@nach-vorne.eu
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Ready for review</i></li></ul><p>Pull request at: <a class="external" href="https://github.com/chiliproject/chiliproject/pull/3">https://github.com/chiliproject/chiliproject/pull/3</a></p> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=10042011-02-12T15:16:42+01:00Felix Schäferfelix+chili@oh14.de
<ul></ul><p>Looks fine to me. Any naysayers?</p> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=10152011-02-14T01:13:16+01:00Eric Davis
<ul><li><strong>Assignee</strong> set to <i>Eric Davis</i></li></ul><p>I'll check it out right now. Still getting my test env all setup.</p> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=10182011-02-14T01:48:16+01:00Eric Davis
<ul><li><strong>Category</strong> changed from <i>User accounts</i> to <i>Testing</i></li><li><strong>Status</strong> changed from <i>Ready for review</i> to <i>Needs more information</i></li></ul><p>How did you set this up? mysql2 won't even run the unit test suite.</p>
<pre>
$ r test:units --trace
(in /home/edavis/dev/chiliproject/core)
** Invoke test:units (first_time)
** Invoke db:test:prepare (first_time)
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
** Execute db:test:prepare
** Invoke db:test:load (first_time)
** Invoke db:test:purge (first_time)
** Invoke environment
** Execute db:test:purge
rake aborted!
Task not supported by 'mysql2'
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/tasks/databases.rake:384
</pre> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=10302011-02-14T08:46:30+01:00Holger Justchiliproject@meine-er.de
<ul><li><strong>Status</strong> changed from <i>Needs more information</i> to <i>Open</i></li></ul><p>mysql2 doesn't support all of the rake tasks by default. Gregor compiled a simple Rails plugin to fix this and add all those rake tasks to mysql too. See <a class="external" href="https://github.com/finnlabs/mysql2_for_rails_2_3_5">https://github.com/finnlabs/mysql2_for_rails_2_3_5</a>.</p> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=10312011-02-14T08:58:55+01:00Gregor Schmidtschmidt@nach-vorne.eu
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Ready for review</i></li></ul><p>Thanks for taking the time and looking into it.</p>
<p>Unfortunately, the mysql2 gem is not yet fully supported in Rails 2.3.5. This is caused by the database rake tasks being to restrictive when testing for MySQL (<a href="https://rails.lighthouseapp.com/projects/8994/tickets/5592-patch-dont-raise-task-not-supported-by-exception-for-mysql2-adapter-in-2-3-stable" class="external">#5592 in Rails' Lighthouse</a>). This should be fixed with Rails 2.3.10.</p>
<p>When using mysql2 in production, this is not an issue, since the db:migrate task works fine and that's the only task, you might want to run on a production system. On the other hand mysql2 is actively maintained and claims to be a faster option.</p>
<p>There are 2 options to reproduce the error within the test suite.</p>
<p>1. Run <code>RAILS_ENV=test db:migrate</code> to migrate the test db and execute the test file in isolation, therefore avoiding the breaking rake tasks: <code>ruby -Itest:lib test/unit/user_test.rb</code></p>
<p>2. Install the <a href="https://github.com/finnlabs/mysql2_for_rails_2_3_5" class="external">mysql2_for_rails_2_3_5</a> Rails plugin. It includes all the necessary fixes, back ported to Rails 2.3.5 using monkey patching. When this plugin is installed, everything should work the same way as with the mysql gem.</p>
<p>Let me know, if I can help out further.</p>
<p>FYI: The continuous integration currently running at ci.nach-vorne.eu uses the second approach. I will write something up on how to get everything running and all open bug reports on other projects.</p> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=10452011-02-14T23:45:40+01:00Eric Davis
<ul><li><strong>Status</strong> changed from <i>Ready for review</i> to <i>Closed</i></li></ul><p>Gregor Schmidt:</p>
<p>After installing the plugin the tests started working with mysql2. I've reviewed your patch and merged it into master.</p>
<p>Thanks for the patches.</p> ChiliProject - Bug #171: unit/user_test.rb:138 fails with mysql2 gemhttps://www.chiliproject.org/issues/171?journal_id=10522011-02-15T08:16:46+01:00Gregor Schmidtschmidt@nach-vorne.eu
<ul></ul><p>Thanks for taking the time.</p>