Re: running Rails AR tests with activerecord-jdbc

  • From: "Nick Sieger" <nicksieger@gmail.com>
  • To: "Stephen Bannasch" <stephen.bannasch@deanbrook.org>
  • Cc: dev@activerecord-jdbc.kenai.com
  • Subject: Re: running Rails AR tests with activerecord-jdbc
  • Date: Sun, 28 Dec 2008 11:54:07 -0600
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=j/XJNg3dT10dWL+vG3rfKrnB5HNF4S+Me9TZZjb23H/DMwjsT0/wqTD8eqzLvMWcju NJbiNObzu0RLZE5aC4Ub0LtS0f0uakz4vMj7txG+Ulp1vYREotV6VYyVyZLQoqawvuA6 71nYa774Sk2KDdXPJbamuK4erm9YuI6XMm1JM=

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
> 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.

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.

> 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

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


running Rails AR tests with activerecord-jdbc

Stephen Bannasch 12/27/2008

<Possible follow-up(s)>

Re: running Rails AR tests with activerecord-jdbc

Nick Sieger 12/28/2008

Re: running Rails AR tests with activerecord-jdbc

Stephen Bannasch 12/29/2008
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close