Sha256: 7eb91cfb928962129bd8b1b9c67ea6a86a090e9096fa4a8f5432da8da680d316
Contents?: true
Size: 943 Bytes
Versions: 1
Compression:
Stored size: 943 Bytes
Contents
class MultithreadingTest < Minitest::Test CustomError = Class.new StandardError def setup @operation = Orchestra::Operation.new do node :map_thread_ids do iterates_over :list provides :thread_ids perform do |item| raise CustomError, "blow up" if item == :blow_up Thread.current.object_id end end self.result = :thread_ids end @conductor = Orchestra::Conductor.new @conductor.thread_count = 5 end def test_multithreading list = (1..1000).to_a thread_ids = @conductor.perform @operation, :list => list assert_equal( @conductor.thread_count, thread_ids.uniq.size, "performance must be spread across threads", ) end def test_exception_during_multithreading list = (1..50).to_a list[23] = :blow_up assert_raises CustomError do @conductor.perform @operation, :list => list end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ntl-orchestra-0.9.2 | test/integration/multithreading_test.rb |