adp-fluentd-plugin-gzip 0.0.6 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5972aada761fe9fdf6104fbe0b961e44fff65e507cf6be08b6cfa9ba9857e296
4
- data.tar.gz: f2a0c1020eeb7926e6f39dcb4f4c99547084f427835647c4e46c1347aad53b9b
3
+ metadata.gz: df5876802b00df66da44d3a050c88eddfbb61a28a7a2da1bad9577921fa89e3c
4
+ data.tar.gz: a9c9c34c677541aea1e1f4c224a6be9889aca5edeb91aa76fd4ba1e137cc5068
5
5
  SHA512:
6
- metadata.gz: f261798083024d9e3777e108aef24a2d181673954823226f8be8acd9c45f0cb4aa9135b0a0c8327e823ca426bbfab38532c007b71c8a57d93e4afb6ecf7efa49
7
- data.tar.gz: 3ff89156b9b14a5ed67d78f70b736c43663347feaf373ef637dd463b554b35c1bcdd54eab71f81e90c54fe919c93025fd7ddcf9f59612b354fe1bf22f915000b
6
+ metadata.gz: '0904d2bd67acff59246d15d2d6c495a203f5d83454a0bc494dde16ba71d14093662bec597a5af22ad83f5d121eb6aa6ae9ab0036a889415a07b48344dd531419'
7
+ data.tar.gz: '0782da9df68907082cc5df7c8ba4cdcaf36cfa1678cdf0ed5915ea067372dcee0033b8226df57452f642757e424053992ed8685acffaaa3accab60b8a00188a5'
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "adp-fluentd-plugin-gzip"
5
- spec.version = "0.0.6"
5
+ spec.version = "0.0.10"
6
6
  spec.authors = ["Aleksander Dudek"]
7
7
  spec.email = ["aleksander.dudek@ringieraxelspringer.pl"]
8
8
 
@@ -1,5 +1,6 @@
1
1
  require 'fluent/plugin/parser'
2
2
  require 'zlib'
3
+ require 'fluent/stream'
3
4
 
4
5
  module Fluent
5
6
  module Plugin
@@ -11,9 +12,8 @@ module Fluent
11
12
  end
12
13
 
13
14
  def parse(text)
14
- log.info("Text: #{text}")
15
- log.info("After compression: #{compress(text)}")
16
- text
15
+ log.warn("Parsing")
16
+ compress(text)
17
17
  end
18
18
 
19
19
  def compress(string, level = Zlib::DEFAULT_COMPRESSION, strategy = Zlib::DEFAULT_STRATEGY)
@@ -0,0 +1,12 @@
1
+ require "stringio"
2
+
3
+ class Stream < StringIO
4
+ def initialize(*)
5
+ super
6
+ set_encoding "BINARY"
7
+ end
8
+
9
+ def close
10
+ rewind;
11
+ end
12
+ end
@@ -1,11 +1,35 @@
1
- require "test_helper"
1
+ require 'test/unit'
2
+ require 'fluent/test/driver/parser'
3
+ require 'fluent/plugin/parser_gzip'
2
4
 
3
- class Adp::Fluentd::Plugin::GzipTest < Minitest::Test
4
- def test_that_it_has_a_version_number
5
- refute_nil ::Adp::Fluentd::Plugin::Gzip::VERSION
5
+ class ParserYourOwnTest < Test::Unit::TestCase
6
+ def setup
6
7
  end
7
-
8
- def test_it_does_something_useful
9
- assert false
8
+ CONFIG = %[
9
+ pattern apache
10
+ ]
11
+ def create_driver(conf = CONF)
12
+ Fluent::Test::Driver::Parser.new(Fluent::Plugin::GzipParser).configure(conf)
13
+ end
14
+ sub_test_case 'configured with invalid configurations' do
15
+ test 'empty' do
16
+ assert_raise(Fluent::ConfigError) do
17
+ create_driver('')
18
+ end
19
+ end
20
+ end
21
+ sub_test_case 'plugin will parse text' do
22
+ test 'record has a field' do
23
+ d = create_driver(CONFIG)
24
+ text = '192.168.0.1 - - [28/Feb/2013:12:00:00 +0900] "GET / HTTP/1.1" 200 777'
25
+ expected_time = event_time('28/Feb/2013:12:00:00 +0900', format: '%d/%b/%Y:%H:%M:%S %z')
26
+ expected_record = {
27
+ 'method' => 'GET',
28
+ }
29
+ d.instance.parse(text) do |time, record|
30
+ assert_equal(expected_time, time)
31
+ assert_equal(expected_record, record)
32
+ end
33
+ end
10
34
  end
11
35
  end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,3 @@
1
- $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
2
- require "adp/fluentd/plugin/gzip"
3
-
4
- require "minitest/autorun"
1
+ require 'test/unit'
2
+ require 'fluent/test'
3
+ require "fluent/plugin/parser_gzip"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adp-fluentd-plugin-gzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksander Dudek
@@ -86,6 +86,7 @@ files:
86
86
  - bin/console
87
87
  - bin/setup
88
88
  - lib/fluent/plugin/parser_gzip.rb
89
+ - lib/fluent/stream.rb
89
90
  - test/adp/fluentd/plugin/gzip_test.rb
90
91
  - test/test_helper.rb
91
92
  homepage: https://example.com