Sha256: 3ef6b10354ba35263bda3ac2ff0e05e61966f216c6b4a08e6687ef6e3ef94ba3
Contents?: true
Size: 790 Bytes
Versions: 11
Compression:
Stored size: 790 Bytes
Contents
# encoding: utf-8 require 'logstash/outputs/gcs/worker_pool' describe LogStash::Outputs::Gcs::WorkerPool do describe '#post' do it 'runs the task in the same thread if synchronous' do pool = LogStash::Outputs::Gcs::WorkerPool.new(5, true) expect(pool.workers).to_not receive(:post) pool.post { 1 + 2 } pool.stop! end it 'runs the task in a different thread if asynchronous' do pool = LogStash::Outputs::Gcs::WorkerPool.new(5, false) expect(pool.workers).to receive(:post) pool.post { 1 + 2 } pool.stop! end it 'raises an error if the pool is already stopped' do pool = LogStash::Outputs::Gcs::WorkerPool.new(5, true) pool.stop! expect{ pool.post{} }.to raise_error(RuntimeError) end end end
Version data entries
11 entries across 11 versions & 2 rubygems