fluentd 1.11.1-x86-mingw32 → 1.12.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +1 -1
  3. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. data/.github/workflows/stale-actions.yml +22 -0
  5. data/.travis.yml +22 -2
  6. data/CHANGELOG.md +111 -0
  7. data/README.md +1 -1
  8. data/appveyor.yml +3 -0
  9. data/bin/fluent-cap-ctl +7 -0
  10. data/bin/fluent-ctl +7 -0
  11. data/example/copy_roundrobin.conf +3 -3
  12. data/example/counter.conf +1 -1
  13. data/example/filter_stdout.conf +2 -2
  14. data/example/{in_dummy_blocks.conf → in_sample_blocks.conf} +4 -4
  15. data/example/{in_dummy_with_compression.conf → in_sample_with_compression.conf} +3 -3
  16. data/example/logevents.conf +5 -5
  17. data/example/multi_filters.conf +1 -1
  18. data/example/out_exec_filter.conf +2 -2
  19. data/example/out_forward.conf +1 -1
  20. data/example/out_forward_buf_file.conf +1 -1
  21. data/example/out_forward_client.conf +5 -5
  22. data/example/out_forward_heartbeat_none.conf +1 -1
  23. data/example/out_forward_sd.conf +1 -1
  24. data/example/out_forward_shared_key.conf +2 -2
  25. data/example/out_forward_tls.conf +1 -1
  26. data/example/out_forward_users.conf +3 -3
  27. data/example/out_null.conf +4 -4
  28. data/example/secondary_file.conf +1 -1
  29. data/fluentd.gemspec +7 -6
  30. data/lib/fluent/capability.rb +87 -0
  31. data/lib/fluent/command/cap_ctl.rb +174 -0
  32. data/lib/fluent/command/ctl.rb +177 -0
  33. data/lib/fluent/command/plugin_config_formatter.rb +2 -1
  34. data/lib/fluent/env.rb +4 -0
  35. data/lib/fluent/log.rb +33 -3
  36. data/lib/fluent/match.rb +9 -0
  37. data/lib/fluent/plugin.rb +5 -0
  38. data/lib/fluent/plugin/buffer.rb +32 -42
  39. data/lib/fluent/plugin/buffer/chunk.rb +2 -1
  40. data/lib/fluent/plugin/formatter.rb +24 -0
  41. data/lib/fluent/plugin/formatter_csv.rb +1 -1
  42. data/lib/fluent/plugin/formatter_hash.rb +3 -1
  43. data/lib/fluent/plugin/formatter_json.rb +3 -1
  44. data/lib/fluent/plugin/formatter_ltsv.rb +5 -3
  45. data/lib/fluent/plugin/formatter_out_file.rb +6 -4
  46. data/lib/fluent/plugin/formatter_single_value.rb +4 -2
  47. data/lib/fluent/plugin/formatter_tsv.rb +4 -2
  48. data/lib/fluent/plugin/in_dummy.rb +2 -123
  49. data/lib/fluent/plugin/in_exec.rb +4 -2
  50. data/lib/fluent/plugin/in_http.rb +25 -4
  51. data/lib/fluent/plugin/in_sample.rb +141 -0
  52. data/lib/fluent/plugin/in_tail.rb +109 -41
  53. data/lib/fluent/plugin/in_tail/position_file.rb +39 -14
  54. data/lib/fluent/plugin/in_tcp.rb +1 -0
  55. data/lib/fluent/plugin/out_http.rb +20 -2
  56. data/lib/fluent/plugin/output.rb +15 -6
  57. data/lib/fluent/plugin/parser_json.rb +5 -2
  58. data/lib/fluent/plugin_helper/cert_option.rb +5 -8
  59. data/lib/fluent/plugin_helper/http_server/compat/server.rb +1 -1
  60. data/lib/fluent/plugin_helper/inject.rb +4 -1
  61. data/lib/fluent/plugin_helper/retry_state.rb +4 -0
  62. data/lib/fluent/plugin_helper/socket.rb +1 -1
  63. data/lib/fluent/supervisor.rb +151 -48
  64. data/lib/fluent/system_config.rb +2 -1
  65. data/lib/fluent/time.rb +1 -0
  66. data/lib/fluent/version.rb +1 -1
  67. data/lib/fluent/winsvc.rb +22 -4
  68. data/test/command/test_binlog_reader.rb +22 -6
  69. data/test/command/test_cap_ctl.rb +100 -0
  70. data/test/command/test_ctl.rb +57 -0
  71. data/test/command/test_plugin_config_formatter.rb +57 -2
  72. data/test/plugin/in_tail/test_position_file.rb +45 -25
  73. data/test/plugin/test_buffer.rb +4 -0
  74. data/test/plugin/test_filter_stdout.rb +6 -1
  75. data/test/plugin/test_formatter_hash.rb +6 -3
  76. data/test/plugin/test_formatter_json.rb +14 -4
  77. data/test/plugin/test_formatter_ltsv.rb +13 -5
  78. data/test/plugin/test_formatter_out_file.rb +35 -14
  79. data/test/plugin/test_formatter_single_value.rb +12 -6
  80. data/test/plugin/test_formatter_tsv.rb +12 -4
  81. data/test/plugin/test_in_exec.rb +18 -0
  82. data/test/plugin/test_in_http.rb +25 -0
  83. data/test/plugin/{test_in_dummy.rb → test_in_sample.rb} +25 -25
  84. data/test/plugin/test_in_tail.rb +433 -30
  85. data/test/plugin/test_out_file.rb +23 -18
  86. data/test/plugin/test_output.rb +12 -0
  87. data/test/plugin/test_parser_syslog.rb +2 -2
  88. data/test/plugin_helper/data/cert/empty.pem +0 -0
  89. data/test/plugin_helper/test_cert_option.rb +7 -0
  90. data/test/plugin_helper/test_compat_parameters.rb +7 -2
  91. data/test/plugin_helper/test_http_server_helper.rb +5 -0
  92. data/test/plugin_helper/test_inject.rb +42 -0
  93. data/test/plugin_helper/test_server.rb +34 -0
  94. data/test/plugin_helper/test_socket.rb +8 -0
  95. data/test/test_capability.rb +74 -0
  96. data/test/test_formatter.rb +34 -10
  97. data/test/test_log.rb +44 -0
  98. data/test/test_match.rb +11 -0
  99. data/test/test_output.rb +6 -1
  100. data/test/test_static_config_analysis.rb +2 -2
  101. data/test/test_supervisor.rb +119 -1
  102. metadata +50 -18
@@ -543,6 +543,8 @@ class BufferTest < Test::Unit::TestCase
543
543
  assert_equal [@dm0,@dm1,@dm1], @p.queue.map(&:metadata)
544
544
  assert_equal [@dm2,@dm3,m], @p.stage.keys
545
545
 
546
+ @p.update_timekeys
547
+
546
548
  assert @p.timekeys.include?(timekey)
547
549
  end
548
550
 
@@ -675,6 +677,8 @@ class BufferTest < Test::Unit::TestCase
675
677
  assert_equal [@dm2,@dm3,m], @p.stage.keys
676
678
  assert_equal 1, @p.stage[m].append_count
677
679
 
680
+ @p.update_timekeys
681
+
678
682
  assert @p.timekeys.include?(timekey)
679
683
  end
680
684
 
@@ -12,6 +12,11 @@ class StdoutFilterTest < Test::Unit::TestCase
12
12
  @old_tz = ENV["TZ"]
13
13
  ENV["TZ"] = "UTC"
14
14
  Timecop.freeze
15
+ @default_newline = if Fluent.windows?
16
+ "\r\n"
17
+ else
18
+ "\n"
19
+ end
15
20
  end
16
21
 
17
22
  def teardown
@@ -106,7 +111,7 @@ class StdoutFilterTest < Test::Unit::TestCase
106
111
  def test_format_json
107
112
  d = create_driver(CONFIG + config_element("", "", { "format" => "json" }))
108
113
  out = capture_log(d) { filter(d, event_time, {'test' => 'test'}) }
109
- assert_equal "{\"test\":\"test\"}\n", out
114
+ assert_equal "{\"test\":\"test\"}#{@default_newline}", out
110
115
  end
111
116
  end
112
117
 
@@ -19,11 +19,14 @@ class HashFormatterTest < ::Test::Unit::TestCase
19
19
  {'message' => 'awesome', 'greeting' => 'hello'}
20
20
  end
21
21
 
22
- def test_format
23
- d = create_driver({})
22
+ data("newline (LF)" => ["lf", "\n"],
23
+ "newline (CRLF)" => ["crlf", "\r\n"])
24
+ def test_format(data)
25
+ newline_conf, newline = data
26
+ d = create_driver({"newline" => newline_conf})
24
27
  formatted = d.instance.format(tag, @time, record)
25
28
 
26
- assert_equal(%Q!{"message"=>"awesome", "greeting"=>"hello"}\n!, formatted.encode(Encoding::UTF_8))
29
+ assert_equal(%Q!{"message"=>"awesome", "greeting"=>"hello"}#{newline}!, formatted.encode(Encoding::UTF_8))
27
30
  end
28
31
 
29
32
  def test_format_without_newline
@@ -7,6 +7,11 @@ class JsonFormatterTest < ::Test::Unit::TestCase
7
7
 
8
8
  def setup
9
9
  @time = event_time
10
+ @default_newline = if Fluent.windows?
11
+ "\r\n"
12
+ else
13
+ "\n"
14
+ end
10
15
  end
11
16
 
12
17
  def create_driver(conf = "")
@@ -25,12 +30,17 @@ class JsonFormatterTest < ::Test::Unit::TestCase
25
30
  {:message => :awesome}
26
31
  end
27
32
 
28
- data('oj' => 'oj', 'yajl' => 'yajl')
33
+ data('oj with LF' => ['oj', "lf", "\n"],
34
+ 'oj with CRLF' => ['oj', "crlf", "\r\n"],
35
+ 'yajl with LF' => ['yajl', "lf", "\n"],
36
+ 'yajl with CRLF' => ['yajl', "crlf", "\r\n"]
37
+ )
29
38
  def test_format(data)
30
- d = create_driver('json_parser' => data)
39
+ parser, newline_conf, newline = data
40
+ d = create_driver('json_parser' => parser, 'newline' => newline_conf)
31
41
  formatted = d.instance.format(tag, @time, record)
32
42
 
33
- assert_equal("#{JSON.generate(record)}\n", formatted)
43
+ assert_equal("#{JSON.generate(record)}#{newline}", formatted)
34
44
  end
35
45
 
36
46
  data('oj' => 'oj', 'yajl' => 'yajl')
@@ -46,6 +56,6 @@ class JsonFormatterTest < ::Test::Unit::TestCase
46
56
  d = create_driver('json_parser' => data)
47
57
  formatted = d.instance.format(tag, @time, symbolic_record)
48
58
 
49
- assert_equal("#{JSON.generate(record)}\n", formatted)
59
+ assert_equal("#{JSON.generate(record)}#{@default_newline}", formatted)
50
60
  end
51
61
  end
@@ -36,11 +36,14 @@ class LabeledTSVFormatterTest < ::Test::Unit::TestCase
36
36
  assert_equal false, d.instance.add_newline
37
37
  end
38
38
 
39
- def test_format
40
- d = create_driver({})
39
+ data("newline (LF)" => ["lf", "\n"],
40
+ "newline (CRLF)" => ["crlf", "\r\n"])
41
+ def test_format(data)
42
+ newline_conf, newline = data
43
+ d = create_driver({"newline" => newline_conf})
41
44
  formatted = d.instance.format(tag, @time, record)
42
45
 
43
- assert_equal("message:awesome\tgreeting:hello\n", formatted)
46
+ assert_equal("message:awesome\tgreeting:hello#{newline}", formatted)
44
47
  end
45
48
 
46
49
  def test_format_without_newline
@@ -50,13 +53,18 @@ class LabeledTSVFormatterTest < ::Test::Unit::TestCase
50
53
  assert_equal("message:awesome\tgreeting:hello", formatted)
51
54
  end
52
55
 
53
- def test_format_with_customized_delimiters
56
+ data("newline (LF)" => ["lf", "\n"],
57
+ "newline (CRLF)" => ["crlf", "\r\n"])
58
+ def test_format_with_customized_delimiters(data)
59
+ newline_conf, newline = data
60
+
54
61
  d = create_driver(
55
62
  'delimiter' => ',',
56
63
  'label_delimiter' => '=',
64
+ 'newline' => newline_conf,
57
65
  )
58
66
  formatted = d.instance.format(tag, @time, record)
59
67
 
60
- assert_equal("message=awesome,greeting=hello\n", formatted)
68
+ assert_equal("message=awesome,greeting=hello#{newline}", formatted)
61
69
  end
62
70
  end
@@ -5,6 +5,11 @@ require 'fluent/plugin/formatter_out_file'
5
5
  class OutFileFormatterTest < ::Test::Unit::TestCase
6
6
  def setup
7
7
  @time = event_time
8
+ @default_newline = if Fluent.windows?
9
+ "\r\n"
10
+ else
11
+ "\n"
12
+ end
8
13
  end
9
14
 
10
15
  def create_driver(conf = {})
@@ -48,48 +53,64 @@ class OutFileFormatterTest < ::Test::Unit::TestCase
48
53
  oldtz, ENV['TZ'] = ENV['TZ'], "UTC+07"
49
54
  d = create_driver(config_element('ROOT', '', {key => value}))
50
55
  tag = 'test'
51
- assert_equal "#{expected}\t#{tag}\t#{Yajl.dump(record)}\n", d.instance.format(tag, time, record)
56
+ assert_equal "#{expected}\t#{tag}\t#{Yajl.dump(record)}#{@default_newline}", d.instance.format(tag, time, record)
52
57
  ensure
53
58
  ENV['TZ'] = oldtz
54
59
  end
55
60
  end
56
61
 
57
- def test_format
58
- d = create_driver({})
62
+ data("newline (LF)" => ["lf", "\n"],
63
+ "newline (CRLF)" => ["crlf", "\r\n"])
64
+ def test_format(data)
65
+ newline_conf, newline = data
66
+ d = create_driver({"newline" => newline_conf})
59
67
  formatted = d.instance.format(tag, @time, record)
60
68
 
61
- assert_equal("#{time2str(@time)}\t#{tag}\t#{Yajl.dump(record)}\n", formatted)
69
+ assert_equal("#{time2str(@time)}\t#{tag}\t#{Yajl.dump(record)}#{newline}", formatted)
62
70
  end
63
71
 
64
- def test_format_without_time
65
- d = create_driver('output_time' => 'false')
72
+ data("newline (LF)" => ["lf", "\n"],
73
+ "newline (CRLF)" => ["crlf", "\r\n"])
74
+ def test_format_without_time(data)
75
+ newline_conf, newline = data
76
+ d = create_driver('output_time' => 'false', 'newline' => newline_conf)
66
77
  formatted = d.instance.format(tag, @time, record)
67
78
 
68
- assert_equal("#{tag}\t#{Yajl.dump(record)}\n", formatted)
79
+ assert_equal("#{tag}\t#{Yajl.dump(record)}#{newline}", formatted)
69
80
  end
70
81
 
71
- def test_format_without_tag
72
- d = create_driver('output_tag' => 'false')
82
+ data("newline (LF)" => ["lf", "\n"],
83
+ "newline (CRLF)" => ["crlf", "\r\n"])
84
+ def test_format_without_tag(data)
85
+ newline_conf, newline = data
86
+ d = create_driver('output_tag' => 'false', 'newline' => newline_conf)
73
87
  formatted = d.instance.format(tag, @time, record)
74
88
 
75
- assert_equal("#{time2str(@time)}\t#{Yajl.dump(record)}\n", formatted)
89
+ assert_equal("#{time2str(@time)}\t#{Yajl.dump(record)}#{newline}", formatted)
76
90
  end
77
91
 
92
+ data("newline (LF)" => ["lf", "\n"],
93
+ "newline (CRLF)" => ["crlf", "\r\n"])
78
94
  def test_format_without_time_and_tag
79
- d = create_driver('output_tag' => 'false', 'output_time' => 'false')
95
+ newline_conf, newline = data
96
+ d = create_driver('output_tag' => 'false', 'output_time' => 'false', 'newline' => newline_conf)
80
97
  formatted = d.instance.format('tag', @time, record)
81
98
 
82
- assert_equal("#{Yajl.dump(record)}\n", formatted)
99
+ assert_equal("#{Yajl.dump(record)}#{newline}", formatted)
83
100
  end
84
101
 
85
- def test_format_without_time_and_tag_against_string_literal_configure
102
+ data("newline (LF)" => ["lf", "\n"],
103
+ "newline (CRLF)" => ["crlf", "\r\n"])
104
+ def test_format_without_time_and_tag_against_string_literal_configure(data)
105
+ newline_conf, newline = data
86
106
  d = create_driver(%[
87
107
  utc true
88
108
  output_tag false
89
109
  output_time false
110
+ newline #{newline_conf}
90
111
  ])
91
112
  formatted = d.instance.format('tag', @time, record)
92
113
 
93
- assert_equal("#{Yajl.dump(record)}\n", formatted)
114
+ assert_equal("#{Yajl.dump(record)}#{newline}", formatted)
94
115
  end
95
116
  end
@@ -17,10 +17,13 @@ class SingleValueFormatterTest < ::Test::Unit::TestCase
17
17
  assert_equal "foobar", d.instance.message_key
18
18
  end
19
19
 
20
- def test_format
21
- d = create_driver
20
+ data("newline (LF)" => ["lf", "\n"],
21
+ "newline (CRLF)" => ["crlf", "\r\n"])
22
+ def test_format(data)
23
+ newline_conf, newline = data
24
+ d = create_driver('newline' => newline_conf)
22
25
  formatted = d.instance.format('tag', event_time, {'message' => 'awesome'})
23
- assert_equal("awesome\n", formatted)
26
+ assert_equal("awesome#{newline}", formatted)
24
27
  end
25
28
 
26
29
  def test_format_without_newline
@@ -29,10 +32,13 @@ class SingleValueFormatterTest < ::Test::Unit::TestCase
29
32
  assert_equal("awesome", formatted)
30
33
  end
31
34
 
32
- def test_format_with_message_key
33
- d = create_driver('message_key' => 'foobar')
35
+ data("newline (LF)" => ["lf", "\n"],
36
+ "newline (CRLF)" => ["crlf", "\r\n"])
37
+ def test_format_with_message_key(data)
38
+ newline_conf, newline = data
39
+ d = create_driver('message_key' => 'foobar', 'newline' => newline_conf)
34
40
  formatted = d.instance.format('tag', event_time, {'foobar' => 'foo'})
35
41
 
36
- assert_equal("foo\n", formatted)
42
+ assert_equal("foo#{newline}", formatted)
37
43
  end
38
44
  end
@@ -37,13 +37,17 @@ class TSVFormatterTest < ::Test::Unit::TestCase
37
37
  assert_equal false, d.instance.add_newline
38
38
  end
39
39
 
40
- def test_format
40
+ data("newline (LF)" => ["lf", "\n"],
41
+ "newline (CRLF)" => ["crlf", "\r\n"])
42
+ def test_format(data)
43
+ newline_conf, newline = data
41
44
  d = create_driver(
42
45
  'keys' => 'message,greeting',
46
+ 'newline' => newline_conf
43
47
  )
44
48
  formatted = d.instance.format(tag, @time, record)
45
49
 
46
- assert_equal("awesome\thello\n", formatted)
50
+ assert_equal("awesome\thello#{newline}", formatted)
47
51
  end
48
52
 
49
53
  def test_format_without_newline
@@ -56,13 +60,17 @@ class TSVFormatterTest < ::Test::Unit::TestCase
56
60
  assert_equal("awesome\thello", formatted)
57
61
  end
58
62
 
59
- def test_format_with_customized_delimiters
63
+ data("newline (LF)" => ["lf", "\n"],
64
+ "newline (CRLF)" => ["crlf", "\r\n"])
65
+ def test_format_with_customized_delimiters(data)
66
+ newline_conf, newline = data
60
67
  d = create_driver(
61
68
  'keys' => 'message,greeting',
62
69
  'delimiter' => ',',
70
+ 'newline' => newline_conf,
63
71
  )
64
72
  formatted = d.instance.format(tag, @time, record)
65
73
 
66
- assert_equal("awesome,hello\n", formatted)
74
+ assert_equal("awesome,hello#{newline}", formatted)
67
75
  end
68
76
  end
@@ -240,4 +240,22 @@ EOC
240
240
  assert_equal [tag, time, record], event
241
241
  }
242
242
  end
243
+
244
+ test 'emit error message with read_with_stderr' do
245
+ d = create_driver %[
246
+ tag test
247
+ command ruby #{File.join(File.dirname(SCRIPT_PATH), 'foo_bar_baz_no_existence.rb')}
248
+ connect_mode read_with_stderr
249
+ <parse>
250
+ @type none
251
+ </parse>
252
+ ]
253
+ d.run(expect_records: 1, timeout: 10)
254
+
255
+ assert{ d.events.length > 0 }
256
+ d.events.each do |event|
257
+ assert_equal 'test', event[0]
258
+ assert_match /LoadError/, event[2]['message']
259
+ end
260
+ end
243
261
  end
@@ -46,6 +46,7 @@ class HttpInputTest < Test::Unit::TestCase
46
46
  assert_equal 10*1024*1024, d.instance.body_size_limit
47
47
  assert_equal 5, d.instance.keepalive_timeout
48
48
  assert_equal false, d.instance.add_http_headers
49
+ assert_equal false, d.instance.add_query_params
49
50
  end
50
51
 
51
52
  def test_time
@@ -907,6 +908,30 @@ class HttpInputTest < Test::Unit::TestCase
907
908
  assert_equal ["403", "403"], res_codes
908
909
  end
909
910
 
911
+ def test_add_query_params
912
+ d = create_driver(CONFIG + "add_query_params true")
913
+ assert_equal true, d.instance.add_query_params
914
+
915
+ time = event_time("2011-01-02 13:14:15 UTC")
916
+ time_i = time.to_i
917
+ events = [
918
+ ["tag1", time, {"a"=>1, "QUERY_A"=>"b"}],
919
+ ["tag2", time, {"a"=>2, "QUERY_A"=>"b"}],
920
+ ]
921
+ res_codes = []
922
+ res_bodies = []
923
+
924
+ d.run do
925
+ events.each do |tag, _t, record|
926
+ res = post("/#{tag}?a=b", {"json"=>record.to_json, "time"=>time_i.to_s})
927
+ res_codes << res.code
928
+ end
929
+ end
930
+ assert_equal ["200", "200"], res_codes
931
+ assert_equal [], res_bodies
932
+ assert_equal events, d.events
933
+ end
934
+
910
935
  $test_in_http_connection_object_ids = []
911
936
  $test_in_http_content_types = []
912
937
  $test_in_http_content_types_flag = false
@@ -1,33 +1,33 @@
1
1
  require_relative '../helper'
2
2
  require 'fluent/test/driver/input'
3
- require 'fluent/plugin/in_dummy'
3
+ require 'fluent/plugin/in_sample'
4
4
  require 'fileutils'
5
5
 
6
- class DummyTest < Test::Unit::TestCase
6
+ class SampleTest < Test::Unit::TestCase
7
7
  def setup
8
8
  Fluent::Test.setup
9
9
  end
10
10
 
11
11
  def create_driver(conf)
12
- Fluent::Test::Driver::Input.new(Fluent::Plugin::DummyInput).configure(conf)
12
+ Fluent::Test::Driver::Input.new(Fluent::Plugin::SampleInput).configure(conf)
13
13
  end
14
14
 
15
15
  sub_test_case 'configure' do
16
16
  test 'required parameters' do
17
17
  assert_raise_message("'tag' parameter is required") do
18
- Fluent::Plugin::DummyInput.new.configure(config_element('ROOT',''))
18
+ Fluent::Plugin::SampleInput.new.configure(config_element('ROOT',''))
19
19
  end
20
20
  end
21
21
 
22
22
  test 'tag' do
23
23
  d = create_driver(%[
24
- tag dummy
24
+ tag sample
25
25
  ])
26
- assert_equal "dummy", d.instance.tag
26
+ assert_equal "sample", d.instance.tag
27
27
  end
28
28
 
29
29
  config = %[
30
- tag dummy
30
+ tag sample
31
31
  ]
32
32
 
33
33
  test 'auto_increment_key' do
@@ -44,30 +44,30 @@ class DummyTest < Test::Unit::TestCase
44
44
  assert_equal 10, d.instance.rate
45
45
  end
46
46
 
47
- test 'dummy' do
47
+ test 'sample' do
48
48
  # hash is okay
49
- d = create_driver(config + %[dummy {"foo":"bar"}])
50
- assert_equal [{"foo"=>"bar"}], d.instance.dummy
49
+ d = create_driver(config + %[sample {"foo":"bar"}])
50
+ assert_equal [{"foo"=>"bar"}], d.instance.sample
51
51
 
52
52
  # array of hash is okay
53
- d = create_driver(config + %[dummy [{"foo":"bar"}]])
54
- assert_equal [{"foo"=>"bar"}], d.instance.dummy
53
+ d = create_driver(config + %[sample [{"foo":"bar"}]])
54
+ assert_equal [{"foo"=>"bar"}], d.instance.sample
55
55
 
56
56
  assert_raise_message(/JSON::ParserError|got incomplete JSON/) do
57
- create_driver(config + %[dummy "foo"])
57
+ create_driver(config + %[sample "foo"])
58
58
  end
59
59
 
60
60
  assert_raise_message(/is not a hash/) do
61
- create_driver(config + %[dummy ["foo"]])
61
+ create_driver(config + %[sample ["foo"]])
62
62
  end
63
63
  end
64
64
  end
65
65
 
66
66
  sub_test_case "emit" do
67
67
  config = %[
68
- tag dummy
68
+ tag sample
69
69
  rate 10
70
- dummy {"foo":"bar"}
70
+ sample {"foo":"bar"}
71
71
  ]
72
72
 
73
73
  test 'simple' do
@@ -75,7 +75,7 @@ class DummyTest < Test::Unit::TestCase
75
75
  d.run(timeout: 0.5)
76
76
 
77
77
  d.events.each do |tag, time, record|
78
- assert_equal("dummy", tag)
78
+ assert_equal("sample", tag)
79
79
  assert_equal({"foo"=>"bar"}, record)
80
80
  assert(time.is_a?(Fluent::EventTime))
81
81
  end
@@ -86,20 +86,20 @@ class DummyTest < Test::Unit::TestCase
86
86
  d.run(timeout: 0.5)
87
87
 
88
88
  d.events.each_with_index do |(tag, _time, record), i|
89
- assert_equal("dummy", tag)
89
+ assert_equal("sample", tag)
90
90
  assert_equal({"foo"=>"bar", "id"=>i}, record)
91
91
  end
92
92
  end
93
93
  end
94
94
 
95
- TEST_PLUGIN_STORAGE_PATH = File.join( File.dirname(File.dirname(__FILE__)), 'tmp', 'in_dummy', 'store' )
95
+ TEST_PLUGIN_STORAGE_PATH = File.join( File.dirname(File.dirname(__FILE__)), 'tmp', 'in_sample', 'store' )
96
96
  FileUtils.mkdir_p TEST_PLUGIN_STORAGE_PATH
97
97
 
98
- sub_test_case 'when dummy plugin has storage which is not specified the path' do
98
+ sub_test_case 'when sample plugin has storage which is not specified the path' do
99
99
  config1 = {
100
- 'tag' => 'dummy',
100
+ 'tag' => 'sample',
101
101
  'rate' => '0',
102
- 'dummy' => '[{"x": 1, "y": "1"}, {"x": 2, "y": "2"}, {"x": 3, "y": "3"}]',
102
+ 'sample' => '[{"x": 1, "y": "1"}, {"x": 2, "y": "2"}, {"x": 3, "y": "3"}]',
103
103
  'auto_increment_key' => 'id',
104
104
  }
105
105
  conf1 = config_element('ROOT', '', config1, [])
@@ -135,7 +135,7 @@ class DummyTest < Test::Unit::TestCase
135
135
  end
136
136
  end
137
137
 
138
- sub_test_case 'when dummy plugin has storage which is specified the path' do
138
+ sub_test_case 'when sample plugin has storage which is specified the path' do
139
139
  setup do
140
140
  FileUtils.rm_rf(TEST_PLUGIN_STORAGE_PATH)
141
141
  FileUtils.mkdir_p(File.join(TEST_PLUGIN_STORAGE_PATH, 'json'))
@@ -144,9 +144,9 @@ class DummyTest < Test::Unit::TestCase
144
144
 
145
145
  config2 = {
146
146
  '@id' => 'test-02',
147
- 'tag' => 'dummy',
147
+ 'tag' => 'sample',
148
148
  'rate' => '0',
149
- 'dummy' => '[{"x": 1, "y": "1"}, {"x": 2, "y": "2"}, {"x": 3, "y": "3"}]',
149
+ 'sample' => '[{"x": 1, "y": "1"}, {"x": 2, "y": "2"}, {"x": 3, "y": "3"}]',
150
150
  'auto_increment_key' => 'id',
151
151
  }
152
152
  conf2 = config_element('ROOT', '', config2, [