fluent-plugin-gelf-hs 1.0.7 → 1.0.8

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.
data.tar.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- 5Bt�pt���udc��-���1��$�_��4�9ŊC�����֠��X��$��elm��NV<��z��ŠPNJ���ADHO���v�d{�L&$< ���7:k���Z5����l� ���а���7�B�;��
2
- �����c~7��-��?s
3
- �"iU�V��]т�9�r�K'�x�;����X&�Nf~�p��#
4
- �`b�_&��"?d忘������Xr�W7B
1
+ a7l �vT��B��9�x�� �7W3qWOy41��mNFj��
2
+ ����#�?b��(��21��� ��ĉ� ��
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |test|
5
+ test.libs << 'test'
6
+ test.pattern = 'test/**/test_*.rb'
7
+ test.verbose = true
8
+ test.warning = false
9
+ end
10
+
11
+ task :default => :test
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
+ s.add_development_dependency "test-unit"
22
+ s.add_development_dependency "rake"
21
23
  s.add_runtime_dependency "fluentd"
22
24
  s.add_runtime_dependency "gelf", ">= 2.0.0"
23
25
 
@@ -63,14 +63,14 @@ module Fluent
63
63
 
64
64
  def format(tag, time, record)
65
65
  if defined? Fluent::EventTime and time.is_a? Fluent::EventTime then
66
- timestamp = time.sec + (time.nsec.to_f/1000000000).round(3)
66
+ timestamp = time.to_i + (time.nsec.to_f/1000000000).round(3)
67
67
  else
68
- timestamp = time
68
+ timestamp = time.to_i
69
69
  end
70
70
 
71
71
  begin
72
72
  make_gelfentry(
73
- tag,time,record,
73
+ tag,timestamp,record,
74
74
  {
75
75
  :use_record_host => @use_record_host,
76
76
  :add_msec_time => @add_msec_time
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class GELFFormatterTest < Test::Unit::TestCase
4
+ def setup
5
+ Fluent::Test.setup
6
+ end
7
+
8
+ CONF = %[
9
+ ]
10
+
11
+ def create_driver(conf = CONF)
12
+ Fluent::Test::FormatterTestDriver.new(Fluent::TextFormatter::GELFFormatter).configure(conf)
13
+ end
14
+
15
+ def test_configure
16
+ d = create_driver
17
+ assert_true d.instance.use_record_host
18
+ assert_false d.instance.add_msec_time
19
+ end
20
+
21
+ def test_format
22
+ d = create_driver
23
+ time = Time.now.to_i
24
+ formatted = d.format('tag', time, {"message" => "gelf"})
25
+ expected = Yajl.dump({"_tag" => "tag",
26
+ "timestamp" => time,
27
+ "short_message" => "gelf",
28
+ "version" => "1.0"}) + "\0"
29
+ assert_equal expected, formatted
30
+ end
31
+ end
@@ -0,0 +1,45 @@
1
+ require 'test_helper'
2
+
3
+ class GELFOutputTest < Test::Unit::TestCase
4
+ def setup
5
+ Fluent::Test.setup
6
+ end
7
+
8
+ CONF = %[
9
+ host localhost
10
+ ]
11
+
12
+ def create_driver(conf = CONF)
13
+ Fluent::Test::BufferedOutputTestDriver.new(Fluent::GELFOutput).configure(conf) do
14
+ def write(chunk)
15
+ chunk.read
16
+ end
17
+ end
18
+ end
19
+
20
+ def test_configure
21
+ d = create_driver
22
+ assert_false d.instance.use_record_host
23
+ assert_false d.instance.add_msec_time
24
+ assert_equal 'localhost', d.instance.host
25
+ assert_equal 12201, d.instance.port
26
+ assert_equal 'udp', d.instance.protocol
27
+ assert_false d.instance.tls
28
+ assert_true d.instance.tls_options.empty?
29
+ end
30
+
31
+ def test_format
32
+ d = create_driver
33
+ time = Time.now
34
+ d.emit({"message" => "gelf"}, time.to_i)
35
+ d.expect_format({'_tag' => 'test', 'timestamp' => time.to_i, 'short_message' => 'gelf'}.to_msgpack)
36
+ d.run
37
+ end
38
+
39
+ def test_write
40
+ d = create_driver
41
+ time = Time.now
42
+ d.emit({"message" => "gelf"}, time.to_i)
43
+ d.run
44
+ end
45
+ end
@@ -0,0 +1,4 @@
1
+ require 'test/unit'
2
+ require 'fluent/test'
3
+ require 'fluent/plugin/out_gelf'
4
+ require 'fluent/plugin/formatter_gelf'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-gelf-hs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 7
10
- version: 1.0.7
9
+ - 8
10
+ version: 1.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Yamauchi
@@ -42,10 +42,10 @@ cert_chain:
42
42
  2Zk648Ep9HVPKmwoVuB75+xEQw==
43
43
  -----END CERTIFICATE-----
44
44
 
45
- date: 2018-05-24 00:00:00 Z
45
+ date: 2019-01-19 00:00:00 Z
46
46
  dependencies:
47
47
  - !ruby/object:Gem::Dependency
48
- name: fluentd
48
+ name: test-unit
49
49
  prerelease: false
50
50
  requirement: &id001 !ruby/object:Gem::Requirement
51
51
  none: false
@@ -56,12 +56,40 @@ dependencies:
56
56
  segments:
57
57
  - 0
58
58
  version: "0"
59
- type: :runtime
59
+ type: :development
60
60
  version_requirements: *id001
61
61
  - !ruby/object:Gem::Dependency
62
- name: gelf
62
+ name: rake
63
63
  prerelease: false
64
64
  requirement: &id002 !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ type: :development
74
+ version_requirements: *id002
75
+ - !ruby/object:Gem::Dependency
76
+ name: fluentd
77
+ prerelease: false
78
+ requirement: &id003 !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ type: :runtime
88
+ version_requirements: *id003
89
+ - !ruby/object:Gem::Dependency
90
+ name: gelf
91
+ prerelease: false
92
+ requirement: &id004 !ruby/object:Gem::Requirement
65
93
  none: false
66
94
  requirements:
67
95
  - - ">="
@@ -73,7 +101,7 @@ dependencies:
73
101
  - 0
74
102
  version: 2.0.0
75
103
  type: :runtime
76
- version_requirements: *id002
104
+ version_requirements: *id004
77
105
  description: Buffered fluentd output plugin to GELF (Graylog2).
78
106
  email:
79
107
  - oss@hotschedules.com
@@ -89,11 +117,15 @@ files:
89
117
  - LICENSE
90
118
  - LICENSE-Apache-2.0.txt
91
119
  - README.md
120
+ - Rakefile
92
121
  - certs/oss@hotschedules.com.cert
93
122
  - fluent-plugin-gelf-hs.gemspec
94
123
  - lib/fluent/gelf_util.rb
95
124
  - lib/fluent/plugin/formatter_gelf.rb
96
125
  - lib/fluent/plugin/out_gelf.rb
126
+ - test/plugin/test_formatter_gelf.rb
127
+ - test/plugin/test_out_gelf.rb
128
+ - test/test_helper.rb
97
129
  homepage: https://github.com/bodhi-space/fluent-plugin-gelf-hs
98
130
  licenses:
99
131
  - Apache-2.0
@@ -127,5 +159,7 @@ rubygems_version: 1.8.25
127
159
  signing_key:
128
160
  specification_version: 3
129
161
  summary: Buffered fluentd output plugin to GELF (Graylog2)
130
- test_files: []
131
-
162
+ test_files:
163
+ - test/plugin/test_formatter_gelf.rb
164
+ - test/plugin/test_out_gelf.rb
165
+ - test/test_helper.rb
metadata.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- L��-�<� ���UǞ�ҹѥ��
2
- f4�A1DJ�cV�S��:��vJ��4��&�p ���ړfi�nij�픴ZÂ�/⡷wW�" lI�'L�`��P|�ܷ=P�����~y��B�� &
1
+ RF���Λ
2
+ ����A1Ɖ�[V��x/.�?O�k
3
- �r���UK(b5��u�?��p5��1<��etCm�"�,�!���{� ~S pM�R%���[�l��5��4�h