running Rails AR tests with activerecord-jdbc
- From: Stephen Bannasch <stephen.bannasch@deanbrook.org>
- To: dev@activerecord-jdbc.kenai.com
- Subject: running Rails AR tests with activerecord-jdbc
- Date: Sat, 27 Dec 2008 15:49:51 -0500
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 could get the version info like this:
ActiveRecord::ConnectionAdapters::JdbcConnection::Version::VERSION
or perhaps:
ActiveRecord::ConnectionAdapters::JdbcAdapter::Version::VERSION
But references to either throw a const_missing error.
uninitialized constant ActiveRecord::ConnectionAdapters::JdbcAdapter::Version (NameError)
uninitialized constant ActiveRecord::ConnectionAdapters::JdbcConnection::Version (NameError)
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 to run) you can run a specific rails AR test like this:
$ jruby -S rake test_jdbcmysql TEST=test/cases/attribute_methods_test.rb
(in /Users/stephen/dev/ruby/src/gems/rails.git/activerecord)
/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/gempackagetask.rb:13:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
/Users/stephen/dev/ruby/src/jruby.git/bin/jruby -Ilib:test:test/connections/jdbc_jdbcmysql "/Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/cases/attribute_methods_test.rb"
Using MySQL via JRuby, activerecord-jdbc-adapter and activerecord-jdbcmysql-adapter
Loaded suite /Users/stephen/dev/ruby/src/jruby.git/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader
Started
........................
Finished in 1.544039 seconds.
24 tests, 257 assertions, 0 failures, 0 errors
There are three of the AR tests which crash jruby and halt the tests so for now I'm running the tests in sections:
# passing
jruby -S rake test_jdbcmysql TEST=test/cases/aaa_create_tables_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/aggregations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/ar_schema_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/belongs_to_associations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/callbacks_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/cascaded_eager_loading_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/eager_load_includes_full_sti_class_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/eager_load_nested_include_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/eager_singularization_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/eager_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/extension_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/has_and_belongs_to_many_associations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/has_many_associations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/has_one_associations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/has_one_through_associations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/inner_join_association_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/join_model_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/attribute_methods_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/binary_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/calculations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/callbacks_observers_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/callbacks_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/class_inheritable_attributes_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/column_alias_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/column_definition_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/database_statements_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/date_time_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/defaults_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/deprecated_finder_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/dirty_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/finder_respond_to_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/finder_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/fixtures_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/i18n_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/inheritance_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/invalid_date_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/json_serialization_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/lifecycle_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/locking_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/method_scoping_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/mixin_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/modules_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/multiple_db_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/named_scope_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/pk_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/pooled_connections_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/readonly_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/reflection_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/reload_models_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/sanitize_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/transactions_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/validations_i18n_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/validations_test.rb
# errors and failures
jruby -S rake test_jdbcmysql TEST=test/cases/adapter_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/associations/has_many_through_associations_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/migration_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/query_cache_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/schema_dumper_test.rb
jruby -S rake test_jdbcmysql TEST=test/cases/unconnected_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
Attachment:
test_ar_with_jruby.diff
Description: Binary data
|
running Rails AR tests with activerecord-jdbc |
Stephen Bannasch | 12/27/2008 |
|
<Possible follow-up(s)> |
||
| Nick Sieger | 12/28/2008 | |
| Stephen Bannasch | 12/29/2008 |






