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

Version Path
logstash-output-google_cloud_storage-4.5.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-google_cloud_storage-4.4.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-google_cloud_storage-4.3.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-google_cloud_storage-4.2.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-google_cloud_storage-4.1.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-google_cloud_storage-4.0.1-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-google_cloud_storage-4.0.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-googlecloudstorage-1.0.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-googlecloudstorage-0.3.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-googlecloudstorage-0.1.0-java spec/outputs/gcs/worker_pool_spec.rb
logstash-output-google_cloud_storage-3.3.0 spec/outputs/gcs/worker_pool_spec.rb