diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-09-30 03:39:15 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-09-30 03:39:15 +0000 |
commit | e8286579738840c3df33dbafe86902d96f0b20f5 (patch) | |
tree | d185d127bd87a44dc1c5f198ff243f8907875244 /activerecord/test/thread_safety_test.rb | |
parent | 4ce9b4c5575cad6f5f1ccd69ddb57d06640e2422 (diff) | |
download | rails-e8286579738840c3df33dbafe86902d96f0b20f5.tar.gz rails-e8286579738840c3df33dbafe86902d96f0b20f5.tar.bz2 rails-e8286579738840c3df33dbafe86902d96f0b20f5.zip |
Move transaction thread-safety test to transactions_test. Check that simultaneous transactions don't step on each others' toes. Check that simultaneous transactions don't give dirty reads (read-committed txn isolation or greater.)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/thread_safety_test.rb')
-rw-r--r-- | activerecord/test/thread_safety_test.rb | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/activerecord/test/thread_safety_test.rb b/activerecord/test/thread_safety_test.rb deleted file mode 100644 index c57c352afc..0000000000 --- a/activerecord/test/thread_safety_test.rb +++ /dev/null @@ -1,36 +0,0 @@ -require 'abstract_unit' -require 'fixtures/topic' - -class ThreadSafetyTest < Test::Unit::TestCase - self.use_transactional_fixtures = false - - fixtures :topics - - def setup - @threads = [] - end - - def test_threading_on_transactions - # SQLite breaks down under thread banging - # Jamis Buck (author of SQLite-ruby): "I know that sqlite itself is not designed for concurrent access" - if ActiveRecord::ConnectionAdapters.const_defined? :SQLiteAdapter - return true if ActiveRecord::Base.connection.instance_of?(ActiveRecord::ConnectionAdapters::SQLiteAdapter) - end - - 5.times do |thread_number| - @threads << Thread.new(thread_number) do |thread_number| - first, second = Topic.find(1, 2) - Topic.transaction(first, second) do - Topic.logger.info "started #{thread_number}" - first.approved = 1 - second.approved = 0 - first.save - second.save - Topic.logger.info "ended #{thread_number}" - end - end - end - - @threads.each { |t| t.join } - end -end |