Sha256: 4ba6831c82534e0545d09c043912fe52443d66318b88671de09d413bce919e54

Contents?: true

Size: 1.34 KB

Versions: 48

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8
require "spec_helper"

describe LogStash::WrappedAckedQueue do
  shared_examples "queue tests" do
    it "is_empty? on creation" do
      expect(queue.is_empty?).to be_truthy
    end

    it "not is_empty? after pushing an element" do
      queue.push(LogStash::Event.new)
      expect(queue.is_empty?).to be_falsey
    end

    it "not is_empty? when all elements are not acked" do
      queue.push(LogStash::Event.new)
      batch = queue.read_batch(1, 250).to_java
      expect(batch.size()).to eq(1)

      expect(queue.is_empty?).to be_falsey
    end

    it "is_empty? when all elements are acked" do
      queue.push(LogStash::Event.new)
      batch = queue.read_batch(1, 250).to_java
      expect(batch.size()).to eq(1)
      expect(queue.is_empty?).to be_falsey
      batch.close
      expect(queue.is_empty?).to be_truthy
    end
  end

  context "persisted" do
    let(:page_capacity) { 1024 }
    let(:max_events) { 0 }
    let(:max_bytes) { 0 }
    let(:checkpoint_acks) { 1024 }
    let(:checkpoint_writes) { 1024 }
    let(:checkpoint_interval) { 0 }
    let(:path) { Stud::Temporary.directory }
    let(:queue) { LogStash::WrappedAckedQueue.new(path, page_capacity, max_events, checkpoint_acks, checkpoint_writes, checkpoint_interval, false, max_bytes) }

    after do
      queue.close
    end

    include_examples "queue tests"
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
logstash-core-7.5.0-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-6.8.5-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.4.2-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-6.8.4-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.4.1-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.4.0-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.3.2-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-6.8.3-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.3.1-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.3.0-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-6.8.2-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.2.1-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.2.0-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-6.8.1-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.1.1-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.1.0-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-6.8.0-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-6.7.2-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.0.1-java spec/logstash/util/wrapped_acked_queue_spec.rb
logstash-core-7.0.0-java spec/logstash/util/wrapped_acked_queue_spec.rb