pat/after_commit

1.0.9 breaks my tests... fixed it by adding gem "after_commit", "1.0.8"

bwlang opened this issue · 10 comments

I recently did a gem update... and 1.0.9 installed itself

Then all my tests broke with reuse of transaction messages and failure to reset Sham.

I'm using test::unit with transactional fixtures and Machinist (in case that matters)

i've fixed the version at 1.0.8 in my Gemfile and I'm back in action.

This could be related to the change in dependency ... my Gemfile.lock says activerecord < 3.0.0 with 1.0.8, but < 3.0.0, >=1.15.6 with 1.0.9.

so... to fix my test breakage i added this line to Gemfile
gem "after_commit", "1.0.8"

before this trouble, after_commit was only added as a dependency and was not explicitly listed.

I have exactly the same issue with 1.0.9. All my tests break when switching to it.

For what's it worth, I'm using Ruby 1.8.7, Rails 2.3.5 and minitest with transactional fixtures.

pat commented

Quick question: are you using MySQL? Or PostgreSQL?

I don't, but I'd be happy to try it out. Unfortunately my schema won't load in MySQL since I'm using some Postgres-specific extensions. Do you know of any simple projects I might be able to fork to try it out?

On Wed, Jun 15, 2011 at 10:12 PM, freelancing-god
reply@reply.github.com
wrote:

Quick question: are you using MySQL? Or PostgreSQL?

I'm using postgresql.

@bwlang To test out the Gemfile.lock version theory, would you mind manually changing the lock file? You should be able to remove the >= 1.15.6 without any issues.

I should note that I have noticed now that when there is a test failure someplace, I do now see messages about reusing transactions. I thought this was related to some other dependency update I did, but I'll look more into after_commit now.

I'm seeing the transaction reuse problems when running after_commit's test suite with activerecord 2.3.12 and sqlite-1.3.3:

  1) Error:
test_after_commit_does_not_trigger_when_unrelated_transaction_commits(AfterCommitTest):
SQLite3::SQLException: cannot start a transaction within a transaction
    /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:97:in `close'
    /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:97:in `prepare'
    /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:134:in `execute'
    /usr/lib64/ruby/gems/1.8/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:484:in `transaction'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/connection_adapters/sqlite_adapter.rb:196:in `begin_db_transaction'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/connection_adapters/sqlite_adapter.rb:418:in `catch_schema_changes'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/connection_adapters/sqlite_adapter.rb:196:in `begin_db_transaction'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/connection_adapters/abstract/database_statements.rb:129:in `transaction'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:182:in `transaction'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:200:in `save!'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:200:in `save!'
    /usr/lib64/ruby/gems/1.8/gems/activerecord-2.3.12/lib/active_record/validations.rb:1071:in `create!'
    ./test/after_commit_test.rb:188:in `test_after_commit_does_not_trigger_when_unrelated_transaction_commits'

(and 24 more similar to this).

pat commented

Okay, just released 1.0.10, should fix these problems.

1.0.10 passes the test suite for me. Thanks!

10.10 passes the test suite for me on mysql with ruby 1.8.7 and 1.9.2 both.
Thanks you!