Skip to content

Commit

Permalink
Calculate bytesize of chunk properly
Browse files Browse the repository at this point in the history
> At v0.12 or ealier, `chunk.size` return bytesize. At v0.14,
> `chunk.size` returns the # of events in the chunk, not bytesize (and
> `chunk.bytesize` is added).
  • Loading branch information
okkez committed Jul 29, 2016
1 parent 7992604 commit 3284ddf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/plugin/test_compressor.rb
Expand Up @@ -46,7 +46,8 @@ def test_compress
io = Tempfile.new("snappy-")
@compressor.compress(chunk, io)
io.open
assert(chunk.size > io.read.bytesize)
chunk_bytesize = chunk.respond_to?(:bytesize) ? chunk.bytesize : chunk.size
assert(chunk_bytesize > io.read.bytesize)
io.rewind
reader = ::Snappy::Reader.new(io)
assert_equal(chunk.read, reader.read)
Expand Down

0 comments on commit 3284ddf

Please sign in to comment.