Skip to content

Commit

Permalink
Add Buffer test
Browse files Browse the repository at this point in the history
  • Loading branch information
ganmacs committed Aug 24, 2016
1 parent a6d1e5e commit 22c86e8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/plugin/test_buffer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require_relative '../helper'
require 'fluent/plugin/buffer'
require 'fluent/plugin/buffer/memory_chunk'
require 'fluent/plugin/buffer/compressable'
require 'fluent/event'
require 'flexmock/test_unit'

Expand Down Expand Up @@ -865,6 +866,10 @@ def create_chunk_es(metadata, es)
assert{ @p.stage[@dm1].size == 2 }
assert @p.stage[@dm1].rollbacked
end

test '#compress returns false' do
assert !@p.compress
end
end

sub_test_case 'standard format with configuration for test with lower chunk limit size' do
Expand Down Expand Up @@ -1197,4 +1202,18 @@ def create_chunk_es(metadata, es)
end
end

sub_test_case 'with configuration compress is true' do |x|
test '#compress returns false' do
p = create_buffer({'compress' => true})
assert p.compress
end

test 'should extend BufferCompressable' do
p = create_buffer({'compress' => true})
chunk = p.generate_chunk(create_metadata)

assert p.singleton_class.ancestors.include?(Fluent::Plugin::Buffer::BufferCompressable)
assert chunk.singleton_class.ancestors.include?(Fluent::Plugin::Buffer::ChunkCompressable)
end
end
end

0 comments on commit 22c86e8

Please sign in to comment.