test/scout/test_work_queue.rb in scout-gear-6.0.0 vs test/scout/test_work_queue.rb in scout-gear-7.1.0
- old
+ new
@@ -87,7 +87,35 @@
q.close
q.join
assert_equal 0, res.length
end
+
+ def test_queue_error
+ num = 10
+ reps = 10_000
+
+ q = WorkQueue.new num do |obj|
+ raise ScoutException if rand < 1
+ [Process.pid.to_s, obj.to_s] * " "
+ end
+
+ res = []
+ q.process do |out|
+ res << out
+ end
+
+ pid = Process.fork do
+ reps.times do |i|
+ q.write i
+ end
+ end
+
+ Process.wait pid
+
+ assert_raise ScoutException do
+ q.close
+ q.join
+ end
+ end
end