fluent-plugin-filter-base64-decode 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: fdf78a3d00d136d7ec6972e053db5d38f23e8a49
4
- data.tar.gz: 159cf9be8fbad6a643ea3fa77943f9a12886b993
3
+ metadata.gz: 6398f5698e0beb9b929ecc9565517b03b76e04c1
4
+ data.tar.gz: 764cdb5b58556cc02b4e6e1cda7020da68cbfd8d
5
5
  SHA512:
6
- metadata.gz: f455800ccee0bdc6345517d2332751bc2075b3d6b5955115a75dec80a9e7f8b806e64423140ccbc6d6d04f172e998fd7b8030952951663cee3c8dfe288f9447d
7
- data.tar.gz: 19988209ad840f7c17008d30b506b70d69f770da333c278b9d33f1ce1b129d05de9c648affe59ad1476f0c7ea0d856a4152c94c1f3711d1d90a0f3d922f1f9af
6
+ metadata.gz: 47bb911578c512ef50852b93ab44378d4386adb4fa3c4097f15bc70c2dc9159d504b6f95c68e830875149283ec86982dca497216d87a56f2b79ad02c021e713a
7
+ data.tar.gz: 571c807f9f50876a0f675bc23b71ea6c9ddb73e2e449534ec71d8b9ad94712613716e2a3713bb11e3a6201e3a11a61fbb998f29cefca4206fd096872ead9b33c
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.license = "MIT"
8
8
  gem.homepage = "https://github.com/MerlinDMC/fluent-plugin-filter-base64-decode"
9
9
  gem.summary = gem.description
10
- gem.version = "0.1.0"
10
+ gem.version = "0.2.0"
11
11
  gem.authors = ["Daniel Malon"]
12
12
  gem.email = "daniel.malon@me.com"
13
13
  gem.has_rdoc = false
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  gem.require_paths = ['lib']
18
18
 
19
- gem.add_runtime_dependency "fluentd", ">= 0.12"
19
+ gem.add_runtime_dependency "fluentd", ">= 0.14.0", "< 2"
20
20
 
21
21
  gem.add_development_dependency "bundler"
22
22
  gem.add_development_dependency "rake"
@@ -3,20 +3,12 @@ require 'base64'
3
3
 
4
4
  require 'fluent/plugin/filter'
5
5
 
6
- module Fluent
7
- class Base64DecodeFilter < Filter
8
- Plugin.register_filter('base64_decode', self)
9
-
10
- def initialize
11
- super
12
- end
6
+ module Fluent::Plugin
7
+ class Base64DecodeFilter < Fluent::Plugin::Filter
8
+ Fluent::Plugin.register_filter('base64_decode', self)
13
9
 
14
10
  config_param :fields, :array, value_type: :string
15
11
 
16
- def configure(conf)
17
- super
18
- end
19
-
20
12
  def filter(tag, time, record)
21
13
  @fields.each { |key|
22
14
  record[key] = Base64.decode64(record[key]) if record.has_key? key
@@ -24,5 +16,5 @@ module Fluent
24
16
  record
25
17
  end
26
18
 
27
- end if defined?(Filter) # Support only >= v0.12
19
+ end
28
20
  end
@@ -3,7 +3,6 @@ require_relative '../test_helper'
3
3
  class Base64DecodeFilterTest < Test::Unit::TestCase
4
4
  def setup
5
5
  Fluent::Test.setup
6
- @time = Fluent::Engine.now
7
6
  end
8
7
 
9
8
  CONFIG = %[
@@ -11,14 +10,7 @@ class Base64DecodeFilterTest < Test::Unit::TestCase
11
10
  ]
12
11
 
13
12
  def create_driver(conf=CONFIG)
14
- Fluent::Test::FilterTestDriver.new(Fluent::Base64DecodeFilter).configure(conf, true)
15
- end
16
-
17
- def emit(config, record)
18
- d = create_driver(config)
19
- d.run {
20
- d.emit(record, @time)
21
- }.filtered
13
+ Fluent::Test::Driver::Filter.new(Fluent::Plugin::Base64DecodeFilter).configure(conf)
22
14
  end
23
15
 
24
16
  test 'configure' do
@@ -27,16 +19,20 @@ class Base64DecodeFilterTest < Test::Unit::TestCase
27
19
  end
28
20
 
29
21
  test 'decode' do
30
- es = emit(CONFIG, {
31
- 'field1' => "T0s=",
32
- 'field3' => "T0s="
33
- })
34
-
35
- es.each { |time, record|
36
- assert_equal 'OK', record['field1']
37
- assert_equal 'T0s=', record['field3']
38
- assert_equal false, record.has_key?('field2')
22
+ d = create_driver(CONFIG)
23
+ record = {
24
+ 'field1' => "T0s=",
25
+ 'field3' => "T0s="
39
26
  }
27
+ d.run(default_tag: "test") do
28
+ d.feed(record)
29
+ end
30
+
31
+ filtered_records = d.filtered_records
32
+ assert_equal(1, filtered_records.size)
33
+ record = filtered_records[0]
34
+ assert_equal 'OK', record['field1']
35
+ assert_equal 'T0s=', record['field3']
36
+ assert_equal false, record.has_key?('field2')
40
37
  end
41
-
42
38
  end
@@ -1,29 +1,9 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
1
+ require 'bundler/setup'
10
2
  require 'test/unit'
11
3
 
12
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
13
- $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(__dir__, '..', 'lib'))
5
+ $LOAD_PATH.unshift(__dir__)
14
6
 
15
7
  require 'fluent/test'
16
- unless ENV.has_key?('VERBOSE')
17
- nulllogger = Object.new
18
- nulllogger.instance_eval {|obj|
19
- def method_missing(method, *args)
20
- # pass
21
- end
22
- }
23
- $log = nulllogger
24
- end
25
-
8
+ require 'fluent/test/driver/filter'
26
9
  require 'fluent/plugin/filter_base64_decode'
27
-
28
- class Test::Unit::TestCase
29
- end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-filter-base64-decode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Malon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-12 00:00:00.000000000 Z
11
+ date: 2017-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -16,14 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.12'
19
+ version: 0.14.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0.12'
29
+ version: 0.14.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -102,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
108
  version: '0'
103
109
  requirements: []
104
110
  rubyforge_project:
105
- rubygems_version: 2.5.2
111
+ rubygems_version: 2.6.13
106
112
  signing_key:
107
113
  specification_version: 4
108
114
  summary: A filter plugin to decode base64 encoded fields