fluent-plugin-elasticsearch 5.0.3 → 5.1.1

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.
@@ -45,7 +45,7 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
45
45
  {
46
46
  'data_streams': [
47
47
  {
48
- 'name' => 'my-data-stream',
48
+ 'name' => 'foo',
49
49
  'timestamp_field' => {
50
50
  'name' => '@timestamp'
51
51
  }
@@ -62,11 +62,11 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
62
62
  DUPLICATED_DATA_STREAM_EXCEPTION = {"error": {}, "status": 400}
63
63
  NONEXISTENT_DATA_STREAM_EXCEPTION = {"error": {}, "status": 404}
64
64
 
65
- def stub_ilm_policy(name="foo")
65
+ def stub_ilm_policy(name="foo_ilm")
66
66
  stub_request(:put, "http://localhost:9200/_ilm/policy/#{name}_policy").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
67
67
  end
68
68
 
69
- def stub_index_template(name="foo")
69
+ def stub_index_template(name="foo_tpl")
70
70
  stub_request(:put, "http://localhost:9200/_index_template/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
71
71
  end
72
72
 
@@ -78,24 +78,60 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
78
78
  stub_request(:get, "http://localhost:9200/_data_stream/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
79
79
  end
80
80
 
81
+ def stub_existent_ilm?(name="foo_ilm")
82
+ stub_request(:get, "http://localhost:9200/_ilm/policy/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
83
+ end
84
+
85
+ def stub_existent_template?(name="foo_tpl")
86
+ stub_request(:get, "http://localhost:9200/_index_template/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
87
+ end
88
+
81
89
  def stub_nonexistent_data_stream?(name="foo")
82
90
  stub_request(:get, "http://localhost:9200/_data_stream/#{name}").to_return(:status => [404, Elasticsearch::Transport::Transport::Errors::NotFound])
83
91
  end
84
92
 
85
- def stub_bulk_feed(name="foo")
86
- stub_request(:post, "http://localhost:9200/#{name}/_bulk").with do |req|
93
+ def stub_nonexistent_ilm?(name="foo_ilm")
94
+ stub_request(:get, "http://localhost:9200/_ilm/policy/#{name}").to_return(:status => [404, Elasticsearch::Transport::Transport::Errors::NotFound])
95
+ end
96
+
97
+ def stub_nonexistent_template?(name="foo_tpl")
98
+ stub_request(:get, "http://localhost:9200/_index_template/#{name}").to_return(:status => [404, Elasticsearch::Transport::Transport::Errors::NotFound])
99
+ end
100
+
101
+ def stub_bulk_feed(datastream_name="foo", ilm_name="foo_ilm", template_name="foo_tpl")
102
+ stub_request(:post, "http://localhost:9200/#{datastream_name}/_bulk").with do |req|
103
+ # bulk data must be pair of OP and records
104
+ # {"create": {}}\nhttp://localhost:9200/_ilm/policy/foo_ilm_bar
105
+ # {"@timestamp": ...}
106
+ @bulk_records += req.body.split("\n").size / 2
107
+ end
108
+ stub_request(:post, "http://localhost:9200/#{ilm_name}/_bulk").with do |req|
109
+ # bulk data must be pair of OP and records
110
+ # {"create": {}}\nhttp://localhost:9200/_ilm/policy/foo_ilm_bar
111
+ # {"@timestamp": ...}
112
+ @bulk_records += req.body.split("\n").size / 2
113
+ end
114
+ stub_request(:post, "http://localhost:9200/#{template_name}/_bulk").with do |req|
87
115
  # bulk data must be pair of OP and records
88
- # {"create": {}}\n
116
+ # {"create": {}}\nhttp://localhost:9200/_ilm/policy/foo_ilm_bar
89
117
  # {"@timestamp": ...}
90
118
  @bulk_records += req.body.split("\n").size / 2
91
119
  end
92
120
  end
93
121
 
94
- def stub_default(name="foo")
95
- stub_ilm_policy(name)
96
- stub_index_template(name)
97
- stub_nonexistent_data_stream?(name)
98
- stub_data_stream(name)
122
+ def stub_elastic_info(url="http://localhost:9200/", version="7.9.0")
123
+ body ="{\"version\":{\"number\":\"#{version}\", \"build_flavor\":\"default\"},\"tagline\" : \"You Know, for Search\"}"
124
+ stub_request(:get, url).to_return({:status => 200, :body => body, :headers => { 'Content-Type' => 'json' } })
125
+ end
126
+
127
+ def stub_default(datastream_name="foo", ilm_name="foo_ilm", template_name="foo_tpl", host="http://localhost:9200")
128
+ stub_elastic_info(host)
129
+ stub_nonexistent_ilm?(ilm_name)
130
+ stub_ilm_policy(ilm_name)
131
+ stub_nonexistent_template?(template_name)
132
+ stub_index_template(template_name)
133
+ stub_nonexistent_data_stream?(datastream_name)
134
+ stub_data_stream(datastream_name)
99
135
  end
100
136
 
101
137
  def data_stream_supported?
@@ -115,82 +151,274 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
115
151
  end
116
152
  end
117
153
 
118
- def test_invalid_uppercase
119
- conf = config_element(
120
- 'ROOT', '', {
121
- '@type' => 'elasticsearch_datastream',
122
- 'data_stream_name' => 'TEST'
123
- })
124
- assert_raise Fluent::ConfigError.new("'data_stream_name' must be lowercase only: <TEST>") do
125
- driver(conf)
154
+ sub_test_case "invalid uppercase" do
155
+ def test_stream_name
156
+ conf = config_element(
157
+ 'ROOT', '', {
158
+ '@type' => 'elasticsearch_datastream',
159
+ 'data_stream_name' => 'TEST',
160
+ 'data_stream_ilm_name' => 'default-policy',
161
+ 'data_stream_template_name' => 'template'
162
+ })
163
+ assert_raise Fluent::ConfigError.new("'data_stream_name' must be lowercase only: <TEST>") do
164
+ driver(conf)
165
+ end
166
+ end
167
+ def test_stream_ilm_name
168
+ conf = config_element(
169
+ 'ROOT', '', {
170
+ '@type' => 'elasticsearch_datastream',
171
+ 'data_stream_name' => 'data_stream',
172
+ 'data_stream_ilm_name' => 'TEST-ILM',
173
+ 'data_stream_template_name' => 'template'
174
+ })
175
+ assert_raise Fluent::ConfigError.new("'data_stream_ilm_name' must be lowercase only: <TEST-ILM>") do
176
+ driver(conf)
177
+ end
178
+ end
179
+ def test_stream_template_name
180
+ conf = config_element(
181
+ 'ROOT', '', {
182
+ '@type' => 'elasticsearch_datastream',
183
+ 'data_stream_name' => 'default',
184
+ 'data_stream_ilm_name' => 'default-policy',
185
+ 'data_stream_template_name' => 'TEST-TPL'
186
+ })
187
+ assert_raise Fluent::ConfigError.new("'data_stream_template_name' must be lowercase only: <TEST-TPL>") do
188
+ driver(conf)
189
+ end
126
190
  end
127
191
  end
128
192
 
129
- data("backslash" => "\\",
130
- "slash" => "/",
131
- "asterisk" => "*",
132
- "question" => "?",
133
- "doublequote" => "\"",
134
- "lt" => "<",
135
- "gt" => ">",
136
- "bar" => "|",
137
- "space" => " ",
138
- "comma" => ",",
139
- "sharp" => "#",
140
- "colon" => ":")
141
- def test_invalid_characters(data)
142
- c, _ = data
143
- conf = config_element(
144
- 'ROOT', '', {
145
- '@type' => ELASTIC_DATA_STREAM_TYPE,
146
- 'data_stream_name' => "TEST#{c}"
147
- })
148
- label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_CHARACTERS.join(',')
149
- assert_raise Fluent::ConfigError.new("'data_stream_name' must not contain invalid characters #{label}: <TEST#{c}>") do
150
- driver(conf)
193
+ sub_test_case "invalid parameters" do
194
+ data("backslash" => "\\",
195
+ "slash" => "/",
196
+ "asterisk" => "*",
197
+ "question" => "?",
198
+ "doublequote" => "\"",
199
+ "lt" => "<",
200
+ "gt" => ">",
201
+ "bar" => "|",
202
+ "space" => " ",
203
+ "comma" => ",",
204
+ "sharp" => "#",
205
+ "colon" => ":")
206
+ def test_stream_name(data)
207
+ c, _ = data
208
+ conf = config_element(
209
+ 'ROOT', '', {
210
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
211
+ 'data_stream_name' => "TEST#{c}",
212
+ 'data_stream_ilm_name' => "default_policy",
213
+ 'data_stream_template_name' => "data_stream"
214
+ })
215
+ label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_CHARACTERS.join(',')
216
+ assert_raise Fluent::ConfigError.new("'data_stream_name' must not contain invalid characters #{label}: <TEST#{c}>") do
217
+ driver(conf)
218
+ end
219
+ end
220
+
221
+ data("backslash" => "\\",
222
+ "slash" => "/",
223
+ "asterisk" => "*",
224
+ "question" => "?",
225
+ "doublequote" => "\"",
226
+ "lt" => "<",
227
+ "gt" => ">",
228
+ "bar" => "|",
229
+ "space" => " ",
230
+ "comma" => ",",
231
+ "sharp" => "#",
232
+ "colon" => ":")
233
+ def test_stream_ilm_name(data)
234
+ c, _ = data
235
+ conf = config_element(
236
+ 'ROOT', '', {
237
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
238
+ 'data_stream_name' => "default",
239
+ 'data_stream_ilm_name' => "TEST#{c}",
240
+ 'data_stream_template_name' => "data_stream"
241
+ })
242
+ label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_CHARACTERS.join(',')
243
+ assert_raise Fluent::ConfigError.new("'data_stream_ilm_name' must not contain invalid characters #{label}: <TEST#{c}>") do
244
+ driver(conf)
245
+ end
246
+ end
247
+
248
+ data("backslash" => "\\",
249
+ "slash" => "/",
250
+ "asterisk" => "*",
251
+ "question" => "?",
252
+ "doublequote" => "\"",
253
+ "lt" => "<",
254
+ "gt" => ">",
255
+ "bar" => "|",
256
+ "space" => " ",
257
+ "comma" => ",",
258
+ "sharp" => "#",
259
+ "colon" => ":")
260
+ def test_stream_template_name(data)
261
+ c, _ = data
262
+ conf = config_element(
263
+ 'ROOT', '', {
264
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
265
+ 'data_stream_name' => "default",
266
+ 'data_stream_ilm_name' => "default_policy",
267
+ 'data_stream_template_name' => "TEST#{c}"
268
+ })
269
+ label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_CHARACTERS.join(',')
270
+ assert_raise Fluent::ConfigError.new("'data_stream_template_name' must not contain invalid characters #{label}: <TEST#{c}>") do
271
+ driver(conf)
272
+ end
151
273
  end
152
274
  end
153
275
 
154
- data("hyphen" => "-",
155
- "underscore" => "_",
156
- "plus" => "+",
157
- "period" => ".")
158
- def test_invalid_start_characters(data)
159
- c, _ = data
160
- conf = config_element(
161
- 'ROOT', '', {
162
- '@type' => ELASTIC_DATA_STREAM_TYPE,
163
- 'data_stream_name' => "#{c}TEST"
164
- })
165
- label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_START_CHRACTERS.join(',')
166
- assert_raise Fluent::ConfigError.new("'data_stream_name' must not start with #{label}: <#{c}TEST>") do
167
- driver(conf)
276
+ sub_test_case "invalid start characters" do
277
+ data("hyphen" => "-",
278
+ "underscore" => "_",
279
+ "plus" => "+",
280
+ "period" => ".")
281
+ def test_stream_name(data)
282
+ c, _ = data
283
+ conf = config_element(
284
+ 'ROOT', '', {
285
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
286
+ 'data_stream_name' => "#{c}TEST",
287
+ 'data_stream_ilm_name' => "default-policy",
288
+ 'data_stream_template_name' => "template"
289
+ })
290
+ label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_START_CHRACTERS.join(',')
291
+ assert_raise Fluent::ConfigError.new("'data_stream_name' must not start with #{label}: <#{c}TEST>") do
292
+ driver(conf)
293
+ end
294
+ end
295
+ data("hyphen" => "-",
296
+ "underscore" => "_",
297
+ "plus" => "+",
298
+ "period" => ".")
299
+ def test_stream_ilm_name(data)
300
+ c, _ = data
301
+ conf = config_element(
302
+ 'ROOT', '', {
303
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
304
+ 'data_stream_name' => "default",
305
+ 'data_stream_ilm_name' => "#{c}TEST",
306
+ 'data_stream_template_name' => "template"
307
+ })
308
+ label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_START_CHRACTERS.join(',')
309
+ assert_raise Fluent::ConfigError.new("'data_stream_ilm_name' must not start with #{label}: <#{c}TEST>") do
310
+ driver(conf)
311
+ end
312
+ end
313
+ data("hyphen" => "-",
314
+ "underscore" => "_",
315
+ "plus" => "+",
316
+ "period" => ".")
317
+ def test_stream_template_name(data)
318
+ c, _ = data
319
+ conf = config_element(
320
+ 'ROOT', '', {
321
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
322
+ 'data_stream_name' => "default",
323
+ 'data_stream_ilm_name' => "default-policy",
324
+ 'data_stream_template_name' => "#{c}TEST"
325
+ })
326
+ label = Fluent::Plugin::ElasticsearchOutputDataStream::INVALID_START_CHRACTERS.join(',')
327
+ assert_raise Fluent::ConfigError.new("'data_stream_template_name' must not start with #{label}: <#{c}TEST>") do
328
+ driver(conf)
329
+ end
168
330
  end
169
331
  end
170
332
 
171
- data("current" => ".",
172
- "parents" => "..")
173
- def test_invalid_dots
174
- c, _ = data
175
- conf = config_element(
176
- 'ROOT', '', {
177
- '@type' => ELASTIC_DATA_STREAM_TYPE,
178
- 'data_stream_name' => "#{c}"
179
- })
180
- assert_raise Fluent::ConfigError.new("'data_stream_name' must not be . or ..: <#{c}>") do
181
- driver(conf)
333
+ sub_test_case "invalid dots" do
334
+ data("current" => ".",
335
+ "parents" => "..")
336
+ def test_stream_name
337
+ c, _ = data
338
+ conf = config_element(
339
+ 'ROOT', '', {
340
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
341
+ 'data_stream_name' => "#{c}",
342
+ 'data_stream_ilm_name' => "default-policy",
343
+ 'data_stream_template_name' => "template"
344
+ })
345
+ assert_raise Fluent::ConfigError.new("'data_stream_name' must not be . or ..: <#{c}>") do
346
+ driver(conf)
347
+ end
348
+ end
349
+
350
+ data("current" => ".",
351
+ "parents" => "..")
352
+ def test_stream_ilm_name
353
+ c, _ = data
354
+ conf = config_element(
355
+ 'ROOT', '', {
356
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
357
+ 'data_stream_name' => "default",
358
+ 'data_stream_ilm_name' => "#{c}",
359
+ 'data_stream_template_name' => "template"
360
+ })
361
+ assert_raise Fluent::ConfigError.new("'data_stream_ilm_name' must not be . or ..: <#{c}>") do
362
+ driver(conf)
363
+ end
364
+ end
365
+
366
+ data("current" => ".",
367
+ "parents" => "..")
368
+ def test_stream_template_name
369
+ c, _ = data
370
+ conf = config_element(
371
+ 'ROOT', '', {
372
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
373
+ 'data_stream_name' => "default",
374
+ 'data_stream_ilm_name' => "default-policy",
375
+ 'data_stream_template_name' => "#{c}"
376
+ })
377
+ assert_raise Fluent::ConfigError.new("'data_stream_template_name' must not be . or ..: <#{c}>") do
378
+ driver(conf)
379
+ end
182
380
  end
183
381
  end
184
382
 
185
- def test_invalid_length
186
- c = "a" * 256
187
- conf = config_element(
188
- 'ROOT', '', {
189
- '@type' => ELASTIC_DATA_STREAM_TYPE,
190
- 'data_stream_name' => "#{c}"
191
- })
192
- assert_raise Fluent::ConfigError.new("'data_stream_name' must not be longer than 255 bytes: <#{c}>") do
193
- driver(conf)
383
+ sub_test_case "invalid length" do
384
+ def test_stream_name
385
+ c = "a" * 256
386
+ conf = config_element(
387
+ 'ROOT', '', {
388
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
389
+ 'data_stream_name' => "#{c}",
390
+ 'data_stream_ilm_name' => "default-policy",
391
+ 'data_stream_template_name' => "template"
392
+ })
393
+ assert_raise Fluent::ConfigError.new("'data_stream_name' must not be longer than 255 bytes: <#{c}>") do
394
+ driver(conf)
395
+ end
396
+ end
397
+ def test_stream_ilm_name
398
+ c = "a" * 256
399
+ conf = config_element(
400
+ 'ROOT', '', {
401
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
402
+ 'data_stream_name' => "default",
403
+ 'data_stream_ilm_name' => "#{c}",
404
+ 'data_stream_template_name' => "template"
405
+ })
406
+ assert_raise Fluent::ConfigError.new("'data_stream_ilm_name' must not be longer than 255 bytes: <#{c}>") do
407
+ driver(conf)
408
+ end
409
+ end
410
+ def test_stream_template_name
411
+ c = "a" * 256
412
+ conf = config_element(
413
+ 'ROOT', '', {
414
+ '@type' => ELASTIC_DATA_STREAM_TYPE,
415
+ 'data_stream_name' => "default",
416
+ 'data_stream_ilm_name' => "default-policy",
417
+ 'data_stream_template_name' => "#{c}"
418
+ })
419
+ assert_raise Fluent::ConfigError.new("'data_stream_template_name' must not be longer than 255 bytes: <#{c}>") do
420
+ driver(conf)
421
+ end
194
422
  end
195
423
  end
196
424
  end
@@ -202,7 +430,9 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
202
430
  conf = config_element(
203
431
  'ROOT', '', {
204
432
  '@type' => ELASTIC_DATA_STREAM_TYPE,
205
- 'data_stream_name' => 'foo'
433
+ 'data_stream_name' => 'foo',
434
+ 'data_stream_ilm_name' => "foo_ilm",
435
+ 'data_stream_template_name' => "foo_tpl"
206
436
  })
207
437
  assert_equal "foo", driver(conf).instance.data_stream_name
208
438
  end
@@ -214,10 +444,13 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
214
444
  stub_index_template
215
445
  stub_existent_data_stream?
216
446
  stub_data_stream
447
+ stub_elastic_info
217
448
  conf = config_element(
218
449
  'ROOT', '', {
219
450
  '@type' => ELASTIC_DATA_STREAM_TYPE,
220
- 'data_stream_name' => 'foo'
451
+ 'data_stream_name' => 'foo',
452
+ 'data_stream_ilm_name' => "foo_ilm",
453
+ 'data_stream_template_name' => "foo_tpl"
221
454
  })
222
455
  assert_equal "foo", driver(conf).instance.data_stream_name
223
456
  end
@@ -225,13 +458,17 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
225
458
  def test_placeholder
226
459
  omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
227
460
 
228
- name = "foo_test"
229
- stub_default(name)
230
- stub_bulk_feed(name)
461
+ dsname = "foo_test"
462
+ ilmname = "foo_ilm_test"
463
+ tplname = "foo_tpl_test"
464
+ stub_default(dsname, ilmname, tplname)
465
+ stub_bulk_feed(dsname, ilmname, tplname)
231
466
  conf = config_element(
232
467
  'ROOT', '', {
233
468
  '@type' => ELASTIC_DATA_STREAM_TYPE,
234
- 'data_stream_name' => 'foo_${tag}'
469
+ 'data_stream_name' => 'foo_${tag}',
470
+ 'data_stream_ilm_name' => "foo_ilm_${tag}",
471
+ 'data_stream_template_name' => "foo_tpl_${tag}"
235
472
  })
236
473
  driver(conf).run(default_tag: 'test') do
237
474
  driver.feed(sample_record)
@@ -243,13 +480,17 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
243
480
  omit REQUIRED_ELASTIC_MESSAGE unless data_stream_supported?
244
481
 
245
482
  time = Time.now
246
- name = "foo_#{time.strftime("%Y%m%d")}"
247
- stub_default(name)
248
- stub_bulk_feed(name)
483
+ dsname = "foo_#{time.strftime("%Y%m%d")}"
484
+ ilmname = "foo_ilm_#{time.strftime("%Y%m%d")}"
485
+ tplname = "foo_tpl_#{time.strftime("%Y%m%d")}"
486
+ stub_default(dsname, ilmname, tplname)
487
+ stub_bulk_feed(dsname, ilmname, tplname)
249
488
  conf = config_element(
250
489
  'ROOT', '', {
251
490
  '@type' => ELASTIC_DATA_STREAM_TYPE,
252
- 'data_stream_name' => 'foo_%Y%m%d'
491
+ 'data_stream_name' => 'foo_%Y%m%d',
492
+ 'data_stream_ilm_name' => 'foo_ilm_%Y%m%d',
493
+ 'data_stream_template_name' => 'foo_tpl_%Y%m%d'
253
494
  }, [config_element('buffer', 'time', {
254
495
  'timekey' => '1d'
255
496
  }, [])]
@@ -265,14 +506,18 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
265
506
 
266
507
  keys = ["bar", "baz"]
267
508
  keys.each do |key|
268
- name = "foo_#{key}"
269
- stub_default(name)
270
- stub_bulk_feed(name)
509
+ dsname = "foo_#{key}"
510
+ ilmname = "foo_ilm_#{key}"
511
+ tplname = "foo_tpl_#{key}"
512
+ stub_default(dsname, ilmname, tplname)
513
+ stub_bulk_feed(dsname, ilmname, tplname)
271
514
  end
272
515
  conf = config_element(
273
516
  'ROOT', '', {
274
517
  '@type' => ELASTIC_DATA_STREAM_TYPE,
275
- 'data_stream_name' => 'foo_${key1}'
518
+ 'data_stream_name' => 'foo_${key1}',
519
+ 'data_stream_ilm_name' => 'foo_ilm_${key1}',
520
+ 'data_stream_template_name' => 'foo_tpl_${key1}'
276
521
  }, [config_element('buffer', 'tag,key1', {
277
522
  'timekey' => '1d'
278
523
  }, [])]
@@ -294,7 +539,9 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
294
539
  conf = config_element(
295
540
  'ROOT', '', {
296
541
  '@type' => ELASTIC_DATA_STREAM_TYPE,
297
- 'data_stream_name' => 'foo'
542
+ 'data_stream_name' => 'foo',
543
+ 'data_stream_ilm_name' => 'foo_ilm',
544
+ 'data_stream_template_name' => 'foo_tpl'
298
545
  })
299
546
  driver(conf).run(default_tag: 'test') do
300
547
  driver.feed(sample_record)
@@ -309,14 +556,16 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
309
556
  template_file = File.join(cwd, 'test_index_template.json')
310
557
 
311
558
  config = %{
312
- host logs.google.com
313
- port 778
314
- scheme https
315
- data_stream_name foo
316
- user john
317
- password doe
318
- template_name logstash
319
- template_file #{template_file}
559
+ host logs.google.com
560
+ port 778
561
+ scheme https
562
+ data_stream_name foo
563
+ data_stream_ilm_name foo_ilm
564
+ data_stream_template_name foo_tpl
565
+ user john
566
+ password doe
567
+ template_name logstash
568
+ template_file #{template_file}
320
569
  max_retry_putting_template 3
321
570
  }
322
571
 
@@ -327,6 +576,7 @@ class ElasticsearchOutputDataStreamTest < Test::Unit::TestCase
327
576
  connection_resets += 1
328
577
  raise Faraday::ConnectionFailed, "Test message"
329
578
  end
579
+ stub_elastic_info("https://logs.google.com:778/")
330
580
 
331
581
  assert_raise(Fluent::Plugin::ElasticsearchError::RetryableOperationExhaustedFailure) do
332
582
  driver(config)