diff options
author | Alexander Polcyn <apolcyn@google.com> | 2016-11-04 11:12:36 -0700 |
---|---|---|
committer | Alexander Polcyn <apolcyn@google.com> | 2016-11-04 11:13:32 -0700 |
commit | 20457a1f09465254d8627300996e9fb90928c18b (patch) | |
tree | 10822cb9f24b05725468e5b4ce0cc0be5ccf4d11 /src/ruby | |
parent | 269e6ccb4d753e2514e80b558327972ff5ca1ae6 (diff) |
clean up pool unit tests
Diffstat (limited to 'src/ruby')
-rw-r--r-- | src/ruby/spec/generic/rpc_server_pool_spec.rb | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb index a34b90594b..8b2ab2dc4e 100644 --- a/src/ruby/spec/generic/rpc_server_pool_spec.rb +++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb @@ -55,7 +55,7 @@ describe GRPC::Pool do it 'it stops being ready after all workers jobs waiting or running' do p = Pool.new(5) p.start - job = proc { sleep(3) } # sleep so workers busy when done scheduling + job = proc { sleep(5) } # sleep so workers busy when done scheduling 5.times do expect(p.ready_for_work?).to be(true) p.schedule(&job) @@ -63,7 +63,7 @@ describe GRPC::Pool do expect(p.ready_for_work?).to be(false) end - it 'it decreases as jobs are run' do + it 'it becomes ready again after jobs complete' do p = Pool.new(5) p.start job = proc {} @@ -72,7 +72,7 @@ describe GRPC::Pool do p.schedule(&job) end expect(p.ready_for_work?).to be(false) - sleep 2 # give the pool time do get at least one task done + sleep 5 # give the pool time do get at least one task done expect(p.ready_for_work?).to be(true) end end @@ -95,7 +95,7 @@ describe GRPC::Pool do p.stop end - it 'it throws an error if all opf the workers have tasks to do' do + it 'it throws an error if all of the workers have tasks to do' do p = Pool.new(5) p.start job = proc {} @@ -129,16 +129,6 @@ describe GRPC::Pool do end describe '#start' do - it 'runs pre-scheduled jobs' do - p = Pool.new(5) - p.start - o, q = Object.new, Queue.new - n = 5 # arbitrary - n.times { p.schedule(o, &q.method(:push)) } - n.times { expect(q.pop).to be(o) } - p.stop - end - it 'runs jobs as they are scheduled' do p = Pool.new(5) o, q = Object.new, Queue.new |