Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Fix AR tests for pg on master

#4519

I get errors (pg 0.9.0, Ruby 1.8.7) while running AR tests:

rake test_postgresql TEST=test/cases/transactions_test.rb
1) Failure:
test_open_transactions_count_is_reset_to_zero_if_no_transaction_active(ConcurrentTransactionTest)
    [./test/cases/transactions_test.rb:374:in `test_open_transactions_count_is_reset_to_zero_if_no_transaction_active'

(snip)

<0> expected but was
<1>.

Reported by Cezary Baginski · May 1st, 2010 @ 06:20 PM

State: resolved
Milestone: 3.0.2
Assigned to: Jeremy Kemper Jeremy Kemper
Importance: Low

Activity

  1. Cezary Baginski
    Cezary Baginski

    Patch for just the transaction tests:

    • PGconn::PQTRANS_IDLE symbol was not available during loading the adaptor, so the outside_transaction? method was not overloaded.

    • Removed the symbol, since it probably was unavailable only in ruby-postgres, which is unsupported anyway

    May 1st, 2010 @ 06:24 PM

  2. Repository
  3. Cezary Baginski
    Cezary Baginski

    Hopefully last fix, this time fixture tests:

    rake test_postgresql TEST=test/cases/fixtures_test.rb
    
    1) Error:
    test_automatically_sets_primary_key(FoxyFixturesTest):
    ActiveRecord::RecordNotFound: Couldn't find Ship with ID=751016583
    
    (snip)
    
    74 tests, 349 assertions, 0 failures, 16 errors
    

    The patch:

    • ships are inserted, but the transaction is rollbacked because connection.reset_pk_sequence! silently fails (because AR is silenced), because it is given the table name :"admin/account" instead of :"admin_account"
    • I tried refactoring the self.create_fixtures method, but gave up, because breaking something else is too easy
    • damn it took me a long time to figure out :)
    • already rebased against master with the previous patch
    • all postgres tests now seem to work

    May 1st, 2010 @ 10:42 PM

  4. Cezary Baginski
    Cezary Baginski

    Almost forgot about the patch ...

    May 1st, 2010 @ 11:08 PM

  5. Cezary Baginski
    Cezary Baginski

    #1748 PostgreSQL adapter and tests incorrectly detect 'postgres' driver - seems related to first problem and can probably be marked as resolved (2-3 works because transaction handling was over-simplified compared to now).

    May 1st, 2010 @ 11:16 PM

  6. Jeremy Kemper
    Jeremy Kemper

    Nice - thanks Cezary!

    May 2nd, 2010 @ 02:52 AM

  7. Jeremy Kemper
  8. Repository
  9. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM