Sha256: c2911542b4a25f230b66f8ba00e7a8c10726866b86c349f89409680911332586

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8
require 'logstash/devutils/rspec/spec_helper'
require 'logstash/outputs/webhdfs'
require 'webhdfs'
require 'logstash-output-webhdfs_jars'


describe "webhdfs helpers" do

  let(:host) { 'localhost' }
  let(:user) { 'hadoop' }
  let(:path) { '/test.log' }

  let(:config) { { 'host' =>host, 'user' => user, 'path' => path, 'compression' => 'none' } }

  let(:sample_data) { "Something very very very long to compress" }

  subject(:plugin) { LogStash::Plugin.lookup("output", "webhdfs").new(config) }

  context "when compressing using vendor snappy" do
    it "should return a valid byte array" do
      compressed = subject.compress_snappy_file(sample_data)

      expect(compressed).not_to be(:nil)
    end

    it "should contains all the data" do
      compressed = subject.compress_snappy_file(sample_data)

      #remove the length integer (32 bit) added by compress_snappy_file, 4 bytes, from compressed
      uncompressed = subject.snappy_inflate(compressed[4..-1])

      expect(uncompressed).to eq(sample_data)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-output-webhdfs-3.1.0-java spec/outputs/webhdfs_helper_spec.rb