Skip to content

Commit de7b334

Browse files
committed
Migrate to use v0.14 API
1 parent 34a3953 commit de7b334

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

lib/fluent/plugin/out_aws-elasticsearch-service.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
require 'faraday_middleware/aws_signers_v4'
77

88

9-
module Fluent
9+
module Fluent::Plugin
1010
class AwsElasticsearchServiceOutput < ElasticsearchOutput
1111

12-
Plugin.register_output('aws-elasticsearch-service', self)
12+
Fluent::Plugin.register_output('aws-elasticsearch-service', self)
1313

1414
config_section :endpoint do
1515
config_param :region, :string
@@ -50,6 +50,10 @@ def get_connection_options
5050
}
5151
end
5252

53+
def write(chunk)
54+
super
55+
end
56+
5357

5458
private
5559

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
11
# -*- encoding: utf-8 -*-
2+
require 'spec_helper'
23

3-
describe Fluent::AwsElasticsearchServiceOutput do
4-
let(:driver) { Fluent::Test::OutputTestDriver.new(Fluent::AwsElasticsearchServiceOutput, 'test.metrics').configure(config) }
4+
describe Fluent::Plugin::AwsElasticsearchServiceOutput do
5+
let(:driver) { Fluent::Test::Driver::Output.new(Fluent::Plugin::AwsElasticsearchServiceOutput).configure(config) }
56
let(:instance) { driver.instance }
67

78
describe "config" do
89
let(:config) do
910
%[
1011
<endpoint>
12+
region us-east-1
1113
url xxxxxxxxxxxxxxxxxxxx
1214
</endpoint>
1315
]
1416
end
1517

1618
it "`endpoint` is array." do
17-
expect( instance.endpoint ).to eq "xxxxxxxxxxxxxxxxxxxx"
19+
instance.instance_variable_get(:@endpoint).map do |ep|
20+
expect(ep[:url]).to eq "xxxxxxxxxxxxxxxxxxxx"
21+
end
1822
end
1923

20-
it "should get room_id" do
21-
expect( instance.room_id ).to eq "1234567890"
24+
it "should get region" do
25+
instance.instance_variable_get(:@endpoint).map do |ep|
26+
expect(ep[:region]).to eq "us-east-1"
27+
end
2228
end
2329

24-
it "should get body" do
25-
expect( instance.body ).to eq "some message"
30+
it "should get default values" do
31+
instance.instance_variable_get(:@endpoint).map do |ep|
32+
expect(ep[:access_key_id]).to eq ""
33+
expect(ep[:secret_access_key]).to eq ""
34+
expect(ep[:assume_role_arn]).to eq nil
35+
expect(ep[:assume_role_session_name]).to eq "fluentd"
36+
end
2637
end
2738
end
2839
end

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require 'fluent/load'
22
require 'fluent/test'
3+
require 'fluent/test/driver/output'
34

45
require 'fluent/plugin/out_aws-elasticsearch-service'
56

0 commit comments

Comments
 (0)