Skip to content

Commit 6cb2a10

Browse files
authored
Merge pull request #32 from cosmo0920/migrate-v0.14
Migrate to use v0.14 API
2 parents a51cf0a + 448cb6c commit 6cb2a10

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ source 'https://rubygems.org'
33
# Specify your gem's dependencies in fluent-plugin-aws-elasticsearch-service.gemspec
44
gemspec
55

6-
gem 'fluent-plugin-elasticsearch', '~> 1.0', require: false
6+
gem 'fluent-plugin-elasticsearch', "~> 2.0.0.rc.1", require: false
77
gem 'aws-sdk', '~> 2', require: false
88
gem 'faraday_middleware-aws-signers-v4', '>= 0.1.0', '< 0.1.2', require: false

fluent-plugin-aws-elasticsearch-service.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Gem::Specification.new do |spec|
2323
spec.add_development_dependency "bundler", "~> 1.10"
2424
spec.add_development_dependency "rake", "~> 10.0"
2525
spec.add_development_dependency "rspec", "~> 3.0"
26+
spec.add_development_dependency "test-unit", "~> 3.0"
2627
spec.add_runtime_dependency "fluentd", "~> 0"
27-
spec.add_runtime_dependency "fluent-plugin-elasticsearch", "~> 1.0"
28+
spec.add_runtime_dependency "fluent-plugin-elasticsearch", "~> 2.0.0.rc.1"
2829
spec.add_runtime_dependency "aws-sdk", "~> 2"
2930
spec.add_runtime_dependency "faraday_middleware-aws-signers-v4", ">= 0.1.0", "< 0.1.2"
3031
end

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
@@ -57,6 +57,10 @@ def get_connection_options
5757
}
5858
end
5959

60+
def write(chunk)
61+
super
62+
end
63+
6064

6165
private
6266

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.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.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.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)