Sha256: 529e4b05e2243f480c668d9934ee8efc1cc99374594c16218f20570ede90a919
Contents?: true
Size: 941 Bytes
Versions: 3
Compression:
Stored size: 941 Bytes
Contents
class MultithreadingTest < Minitest::Test CustomError = Class.new StandardError def setup @operation = Orchestra::Operation.new do step :map_thread_ids do iterates_over :list provides :thread_ids execute 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.execute @operation, :list => list assert_equal( @conductor.thread_count, thread_ids.uniq.size, "execution 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.execute @operation, :list => list end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ntl-orchestra-0.9.5 | test/integration/multithreading_test.rb |
ntl-orchestra-0.9.4 | test/integration/multithreading_test.rb |
ntl-orchestra-0.9.3 | test/integration/multithreading_test.rb |