I want to run multiple test processes against one database. Each process needs to see the database as if it were the only process. Nested transactions (putting the whole test in a transaction) would do it, but Postgres can't do that. Is there another way?
-
Show this thread
-
I don't think transactions help at all. The app under test will use transactions. You can't nest transactions in Postgres, so wrapping the whole test run in a transaction would preclude the app's normal use of them.
3 replies 0 retweets 4 likesShow this thread -
Replying to @garybernhardt
You can emulate nested transactions with savepoints.
1 reply 0 retweets 1 like -
Replying to @sgrif
Yeah, but the app already does transactions in the usual way, so I don't think I can do that without modifying the app?
1 reply 0 retweets 0 likes -
Replying to @garybernhardt
How is the app executing its queries? Are you just using raw SQL? No abstraction layer that can help? (e.g. something like https://github.com/diesel-rs/diesel/blob/master/diesel/src/connection/transaction_manager.rs#L86-L126 …)
1 reply 0 retweets 0 likes -
-
Replying to @garybernhardt
AR should already do nested transaction emulation as long as you do requires_new: true
1 reply 0 retweets 0 likes
See the nested transaction section http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/DatabaseStatements.html#method-i-transaction …
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.