adp-fluentd-plugin-gzip 0.0.5 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d64b401c92b4a5c10a6a08ec7f6bbe1eb0e905dec4c1a165241facf3a7cab4ad
4
- data.tar.gz: '087fce736af304a20efd923ac0f2af9e9237d66e3f01a17a31a8e92e8f7c67c3'
3
+ metadata.gz: effad8e5c9523b52cecb84e278ea512c886ad5e28a1ab4eed4ef64e9f1ce1fae
4
+ data.tar.gz: a057973d105fe2f28f46c3829533598a13b90442e0a4f147880933f9249f6e7b
5
5
  SHA512:
6
- metadata.gz: 016b14226653374078bb5188b0385e8736af11c500c1d54400f30ab84c68acf7165bbc373f918b1ed3363f800798a85477cb66c074bf154963e1fc80c78eba6c
7
- data.tar.gz: ec6ab9697ea8170e05aab9382adc1bef5850cfe35fe93abae33ab05a429794c229048e6c6e826d20bf05c0363b4a0312322eac033e4d48ade20e58f5803f1522
6
+ metadata.gz: 44ef566e072274e3c867b6de6434bc34ffcf1eadc05d709bb6838855960a34dbb5a74af49f91d2703a8e70f5c1a1237c10adbda7534f04c911de8b17dcc8507c
7
+ data.tar.gz: f022c340d53300ba1acc9ac49de7cf0a00b062f65e07855e8aa23e558d4b47c4595aa0d672cd3800ad73810cc0635700132b9fae4ad4360f08b1b882c2638ae8
@@ -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.5"
5
+ spec.version = "0.0.9"
6
6
  spec.authors = ["Aleksander Dudek"]
7
7
  spec.email = ["aleksander.dudek@ringieraxelspringer.pl"]
8
8
 
@@ -1,9 +1,6 @@
1
1
  require 'fluent/plugin/parser'
2
2
  require 'zlib'
3
- require 'logger'
4
-
5
- logger = Logger.new(STDOUT)
6
- logger.level = Logger::INFO
3
+ require 'fluent/stream'
7
4
 
8
5
  module Fluent
9
6
  module Plugin
@@ -15,9 +12,7 @@ module Fluent
15
12
  end
16
13
 
17
14
  def parse(text)
18
- logger.info("Text: #{text}")
19
- logger.info("After compression: #{compress(text)}")
20
- text
15
+ compress(text)
21
16
  end
22
17
 
23
18
  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.5
4
+ version: 0.0.9
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