Skip to content
Permalink
Browse files

Moved auto_terminate daemon test to executor_service_shared.rb

  • Loading branch information
fzakaria committed Feb 5, 2020
1 parent f2de94a commit 2c13ac6a288e2c8b99aceedfe1f2befefd5fb787
@@ -201,28 +201,6 @@ module Concurrent
end
end

context 'auto terminate' do

# https://github.com/ruby-concurrency/concurrent-ruby/issues/817
# https://github.com/ruby-concurrency/concurrent-ruby/issues/839
it 'does not stop shutdown ' do
Timeout.timeout(10) do
begin
test_file = File.join File.dirname(__FILE__), 'pool_quits.rb'
pid = spawn RbConfig.ruby, test_file
Process.waitpid pid
expect($?.success?).to eq true
rescue Errno::ECHILD
# child already gone
rescue Timeout::Error => e
Process.kill :KILL, pid
raise e
end
end
end

end

context 'stress', notravis: true do
configurations = [
{ min_threads: 2,
@@ -4,9 +4,11 @@

require 'concurrent-ruby'

pool = Concurrent::CachedThreadPool.new
pool.post do
sleep # sleep indefinitely
executors = [Concurrent::CachedThreadPool.new, Concurrent::SingleThreadExecutor.new, Concurrent::FixedThreadPool.new(1)]
executors.each do |executor|
executor.post do
sleep # sleep indefinitely
end
end

# the process main thread should quit out which should kill the daemon CachedThreadPool
@@ -33,6 +33,28 @@
end
end

context 'auto terminate' do

# https://github.com/ruby-concurrency/concurrent-ruby/issues/817
# https://github.com/ruby-concurrency/concurrent-ruby/issues/839
it 'does not stop shutdown ' do
Timeout.timeout(10) do
begin
test_file = File.join File.dirname(__FILE__), 'executor_quits.rb'
pid = spawn RbConfig.ruby, test_file
Process.waitpid pid
expect($?.success?).to eq true
rescue Errno::ECHILD
# child already gone
rescue Timeout::Error => e
Process.kill :KILL, pid
raise e
end
end
end

end

context '#running?' do

it 'returns true when the thread pool is running' do

0 comments on commit 2c13ac6

Please sign in to comment.
You can’t perform that action at this time.