This project is archived and is in readonly mode.

#1685 ✓committed
Stephen Bannasch

Add AR test-connections for JDBC via JRuby

Reported by Stephen Bannasch | January 2nd, 2009 @ 05:16 AM | in 2.x

This is a patch for the AR tests that support running them in JRuby using jdbc connections.

A big part of the reason I'm working on this is to make it easier to test JRuby itself.

For example while developing these tests I found that running them caused JRuby to crash. On Dec 30 2008 Charlie Nutter fixed a JRuby regression that caused these tests to crash. If I can make it easier to run these tests in JRuby we'll find and fix these problems faster.

Here's the JRuby crash I found running the jdbcmysql tests:

The problem was related to hpricot using a deprecated and then deleted JRuby method that was part of it's implementation of fast_xs. AS uses fast_xs if it is present ...

That's just the kind of confusing bug that will be quicker to uncover if it's easier to run these tests in JRuby.

I run the AR mysql jdbc tests like this:

$ jruby -S rake test_jdbcmysql

This patch may well still need some work. I'm going to see if I can get Nick Sieger (recent activerecord-jdbc developer) to review them.

test status with trunk JRuby (r8541) and activerecord-jdbc v0.9

jdbcmysql:      1807 tests, 6004 assertions, 20 failures, 1 errors
jdbcpostgresql: 1812 tests, 1310 assertions, 4 failures, 1675 errors
jdbcsqlite3:    1807 tests, 889 assertions, 15 failures, 1673 errors
jdbch2:         1807 tests, 1809 assertions, 41 failures, 1361 errors
jdbchsqldb:     1807 tests, 4181 assertions, 33 failures, 553 errors
jdbcderby:      1812 tests, 759 assertions, 20 failures, 1765 errors

  • jdbcderby test took over 10m to run

I'm using these gems for the test results above:

$ jruby -S gem list --local activerecord-jdbc

*** LOCAL GEMS ***

activerecord-jdbc-adapter (0.9)
activerecord-jdbcderby-adapter (0.9)
activerecord-jdbch2-adapter (0.9)
activerecord-jdbchsqldb-adapter (0.9)
activerecord-jdbcmysql-adapter (0.9)
activerecord-jdbcpostgresql-adapter (0.9)
activerecord-jdbcsqlite3-adapter (0.9)

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Referenced by