Re: running Rails AR tests with activerecord-jdbc
- From: Stephen Bannasch <stephen.bannasch@deanbrook.org>
- To: "Nick Sieger" <nicksieger@gmail.com>
- Cc: dev@activerecord-jdbc.kenai.com
- Subject: Re: running Rails AR tests with activerecord-jdbc
- Date: Mon, 29 Dec 2008 03:27:04 -0500
At 11:54 AM -0600 12/28/08, Nick Sieger wrote:
On Sat, Dec 27, 2008 at 2:49 PM, Stephen Bannasch
<stephen.bannasch@deanbrook.org> wrote:
Hi Nick,>
I'm working on running the rails AR tests in JRuby and would like to display
the version of both activerecord-jdbc-adapter and the database adapter it is
using.
Initially I'm trying to get these tests working just using mysql so I'd like>
to get these version numbers:
activerecord-jdbc-adapter
activerecord-jdbcmysql-adapter
Which for the gems I've got installed now should be 0.9 for both.
Looking at the code I assumed that once the connection was established I> ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION
could get the version info like this:
ActiveRecord::ConnectionAdapters::JdbcConnection::Version::VERSION
or perhaps:
But references to either throw a const_missing error.
I don't actually have version numbers for the driver-specific adapter
gems, they just use the same versions as the main one. So
JdbcAdapter::Version::VERSION is probably all that you need.
This reference can't be found:
ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION
when evaluated in:
test/connections/jdbc_jdbcmysql/connection.rb
I'd like to extend the tests for AR to include more than mysql but I wanted to first get them displaying some of the version info for JRuby, and the ar-jdbc stuff so I can more easily tell the context for the tests.
Mostly my context for running the tests is to evaluate version of jruby, the ar-jdbc framework, and the db's themselves.
I want it to be easy to tell if I am using a newer version of ar-jdbc.
Once this is working for mysql it should be easy to extend the rails-ar patch to include other jdbc dbs which are appropriate.
And outside the scope of this list -- run all the rails tests under JRuby.
> I've attached my patch to trunk rails (actually just to the active_record
gem). After applying the patch (and setting up the proper db for the tests> (in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord)
to run) you can run a specific rails AR test like this:
$ jruby -S rake test_jdbcmysql TEST=test/cases/attribute_methods_test.rb
>
...
> # jruby crashes during test
jruby -S rake test_jdbcmysql TEST=test/cases/base_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/serialization_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/xml_serialization_test.rb
Excellent. Thanks for looking into this, it's been awhile since we
tried running all of ActiveRecord's tests. I'll see if I can lobby
rails-core to include some form of these changes into activerecord so
we don't have to separately maintain them.
/Nick
I've tracked down the JRuby crash in these tests to a combination of running the method 'to_xml' on an AR instance and this large changeset in JRuby from Dec 18:
svn rev:8398
"Grr...I suppose I should have checked this before, but Mongrel still
uses CallbackFactory. We need to get them off it so we can delete it
some day. Damn you, crufty old dependencies!"
See second message in this thread on jruby-dev:
http://www.nabble.com/jruby-crashes-running-the-rails-AR-tests-with-ar-jdbc-tt21187922.html
I was planning to open a JRuby Jira issue but I haven't yet simplified the problem well enough to give a short test case or description.
| Stephen Bannasch | 12/27/2008 | |
|
<Possible follow-up(s)> |
||
| Nick Sieger | 12/28/2008 | |
|
Re: running Rails AR tests with activerecord-jdbc |
Stephen Bannasch | 12/29/2008 |






