fluentd-ui 1.0.0.beta.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fluentd-ui might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ChangeLog.md +24 -0
- data/Gemfile +5 -3
- data/Gemfile.lock +88 -75
- data/README.md +11 -0
- data/Rakefile +1 -1
- data/app/javascript/packs/aws_credential.js +1 -1
- data/app/javascript/packs/in_tail_parse.js +1 -1
- data/app/javascript/packs/owned_plugin_form.js +1 -1
- data/app/javascript/packs/settings.js +20 -9
- data/app/javascript/packs/transport_config.js +1 -1
- data/app/javascript/packs/transport_section.js +1 -1
- data/app/javascript/packs/treeview.js +2 -2
- data/app/models/plugin.rb +2 -2
- data/app/views/fluentd/settings/source_and_output.html.haml +12 -10
- data/app/views/layouts/application.html.erb +3 -0
- data/app/views/plugins/recommended.html.haml +3 -0
- data/app/views/plugins/updated.html.haml +5 -6
- data/config.ru +3 -1
- data/config/application.rb +1 -1
- data/config/application.yml +104 -31
- data/config/locales/translation_en.yml +1 -0
- data/config/locales/translation_ja.yml +1 -0
- data/gemfiles/ruby2.2.gemfile +2 -1
- data/lib/fluentd-ui/version.rb +1 -1
- data/test/application_system_test_case.rb +8 -0
- data/test/controllers/application_controller_test.rb +42 -0
- data/test/controllers/fluentd/agents_controller_test.rb +39 -0
- data/test/controllers/misc_controller_test.rb +70 -0
- data/test/controllers/polling_controller_test.rb +29 -0
- data/test/decorators/plugin_decorator_test.rb +26 -0
- data/{spec → test}/factories/fluentd.rb +0 -0
- data/{spec → test}/factories/plugins.rb +0 -0
- data/{spec → test}/factories/user.rb +0 -0
- data/{spec/support → test}/fixtures/error0.log +0 -0
- data/{spec/support → test}/fixtures/error2.log +0 -0
- data/{spec/support → test}/fixtures/error3.log +0 -0
- data/{spec/support → test}/fixtures/error4.log +0 -0
- data/{spec/support → test}/fixtures/multiline_example.log +0 -0
- data/test/integration/dashboard_test.rb +57 -0
- data/test/integration/fluentd/setting/histories_test.rb +139 -0
- data/test/integration/fluentd/setting/notes_test.rb +27 -0
- data/test/integration/fluentd/setting/running_backup_test.rb +65 -0
- data/test/integration/fluentd_ui_update_checking_test.rb +27 -0
- data/test/integration/sesstions_test.rb +56 -0
- data/test/integration/setting_test.rb +126 -0
- data/test/integration/users_test.rb +43 -0
- data/test/lib/filte_reverse_reader_test.rb +63 -0
- data/test/lib/fluentd_ui_test.rb +36 -0
- data/test/lib/regexp_preview/multi_line_test.rb +86 -0
- data/test/lib/regexp_preview/single_line_test.rb +87 -0
- data/test/models/fluent_gem_test.rb +76 -0
- data/test/models/fluentd/agent_test.rb +331 -0
- data/{spec/models/fluentd/setting/in_forward_spec.rb → test/models/fluentd/setting/in_forward_test.rb} +32 -44
- data/test/models/fluentd/setting/in_http_test.rb +30 -0
- data/test/models/fluentd/setting/in_monitor_agent_test.rb +30 -0
- data/test/models/fluentd/setting/in_syslog_test.rb +88 -0
- data/test/models/fluentd/setting/in_tail_test.rb +52 -0
- data/test/models/fluentd/setting/out_elasticsearch_test.rb +32 -0
- data/test/models/fluentd/setting/out_mongo_test.rb +61 -0
- data/test/models/fluentd/setting/out_s3_test.rb +112 -0
- data/test/models/fluentd/setting/out_stdout_test.rb +32 -0
- data/test/models/fluentd/setting/out_tdlog_test.rb +60 -0
- data/test/models/fluentd_log_test.rb +140 -0
- data/test/models/fluentd_test.rb +185 -0
- data/test/models/plugin_test.rb +144 -0
- data/test/models/user_test.rb +48 -0
- data/test/support/config_histories.rb +72 -0
- data/test/support/configurable_daemon_settings.rb +26 -0
- data/test/support/login_macro.rb +12 -0
- data/test/support/login_required.rb +8 -0
- data/test/support/stub_daemon.rb +14 -0
- data/test/system/fluentd/setting/in_forward_test.rb +13 -0
- data/test/system/fluentd/setting/in_http_test.rb +13 -0
- data/test/system/fluentd/setting/in_monitor_agent.rb +13 -0
- data/test/system/fluentd/setting/out_elasticsearch_test.rb +32 -0
- data/test/system/fluentd/setting/out_forward_test.rb +41 -0
- data/test/system/fluentd/setting/out_stdout_test.rb +15 -0
- data/test/system/fluentd/setting/out_tdlog_test.rb +15 -0
- data/test/system/source_and_output_test.rb +184 -0
- data/test/test_helper.rb +34 -0
- metadata +147 -161
- data/spec/controllers/application_controller_spec.rb +0 -84
- data/spec/controllers/fluentd/agents_controller_spec.rb +0 -61
- data/spec/controllers/misc_controller_spec.rb +0 -68
- data/spec/controllers/polling_controller_spec.rb +0 -39
- data/spec/controllers/sessions_controller_spec.rb +0 -5
- data/spec/decorators/plugin_decorator_spec.rb +0 -37
- data/spec/features/dashboard_spec.rb +0 -42
- data/spec/features/fluentd/setting/histories_spec.rb +0 -110
- data/spec/features/fluentd/setting/in_forward_spec.rb +0 -6
- data/spec/features/fluentd/setting/in_http_spec.rb +0 -6
- data/spec/features/fluentd/setting/in_monitor_agent_spec.rb +0 -6
- data/spec/features/fluentd/setting/notes_spec.rb +0 -27
- data/spec/features/fluentd/setting/out_forward_spec.rb +0 -38
- data/spec/features/fluentd/setting/out_stdout_spec.rb +0 -6
- data/spec/features/fluentd/setting/running_backup_spec.rb +0 -106
- data/spec/features/fluentd_status_spec.rb +0 -36
- data/spec/features/fluentd_ui_update_available_spec.rb +0 -33
- data/spec/features/out_elasticsearch_spec.rb +0 -28
- data/spec/features/out_forward_spec.rb +0 -36
- data/spec/features/out_tdlog_spec.rb +0 -26
- data/spec/features/sessions_spec.rb +0 -79
- data/spec/features/setting_spec.rb +0 -95
- data/spec/features/shared_examples/configurable_daemon_settings.rb +0 -17
- data/spec/features/shared_examples/login_required.rb +0 -4
- data/spec/features/source_and_output_spec.rb +0 -158
- data/spec/features/users_spec.rb +0 -53
- data/spec/grok_converter_spec.rb +0 -50
- data/spec/lib/file_reverse_reader_spec.rb +0 -93
- data/spec/lib/fluentd-ui_spec.rb +0 -35
- data/spec/lib/regexp_preview/multi_line_spec.rb +0 -111
- data/spec/lib/regexp_preview/single_line_spec.rb +0 -185
- data/spec/models/fluent_gem_spec.rb +0 -104
- data/spec/models/fluentd/agent/common_spec.rb +0 -82
- data/spec/models/fluentd/agent_spec.rb +0 -134
- data/spec/models/fluentd/setting/in_http_spec.rb +0 -31
- data/spec/models/fluentd/setting/in_monitor_agent_spec.rb +0 -31
- data/spec/models/fluentd/setting/in_syslog_spec.rb +0 -98
- data/spec/models/fluentd/setting/in_tail_spec.rb +0 -53
- data/spec/models/fluentd/setting/out_elasticsearch_spec.rb +0 -31
- data/spec/models/fluentd/setting/out_mongo_spec.rb +0 -62
- data/spec/models/fluentd/setting/out_s3_spec.rb +0 -128
- data/spec/models/fluentd/setting/out_stdout_spec.rb +0 -31
- data/spec/models/fluentd/setting/out_tdlog_spec.rb +0 -46
- data/spec/models/fluentd_log_spec.rb +0 -171
- data/spec/models/fluentd_spec.rb +0 -164
- data/spec/models/plugin_spec.rb +0 -191
- data/spec/models/user_spec.rb +0 -59
- data/spec/spec_helper.rb +0 -85
- data/spec/support/config_histories.rb +0 -57
- data/spec/support/fluentd_agent_common_behavior.rb +0 -181
- data/spec/support/fluentd_agent_restart_strategy.rb +0 -94
- data/spec/support/javascript_macro.rb +0 -21
- data/spec/support/login_macro.rb +0 -10
- data/spec/support/stub_daemon.rb +0 -12
@@ -1,16 +1,13 @@
|
|
1
|
-
require
|
1
|
+
require "test_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}
|
3
|
+
module Fluentd::Setting
|
4
|
+
class InForwardTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
@klass = Fluentd::Setting::InForward
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
let(:expected) do
|
13
|
-
{
|
9
|
+
test ".initial_params" do
|
10
|
+
expected = {
|
14
11
|
log_level: nil,
|
15
12
|
port: 24224,
|
16
13
|
bind: "0.0.0.0",
|
@@ -62,35 +59,31 @@ describe Fluentd::Setting::InForward do
|
|
62
59
|
}
|
63
60
|
},
|
64
61
|
}
|
62
|
+
assert_equal(expected, @klass.initial_params)
|
65
63
|
end
|
66
|
-
it { should == expected }
|
67
|
-
end
|
68
64
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
65
|
+
test "#valid?" do
|
66
|
+
assert do
|
67
|
+
@klass.new({}).valid?
|
68
|
+
end
|
73
69
|
end
|
74
|
-
end
|
75
70
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
71
|
+
test "#plugin_name" do
|
72
|
+
assert_equal("forward", @klass.new({}).plugin_name)
|
73
|
+
end
|
80
74
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
end
|
75
|
+
test "#plugin_type" do
|
76
|
+
assert_equal("input", @klass.new({}).plugin_type)
|
77
|
+
end
|
85
78
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
79
|
+
test "#to_config" do
|
80
|
+
assert do
|
81
|
+
@klass.new({}).to_config.to_s.include?("@type forward")
|
82
|
+
end
|
83
|
+
end
|
90
84
|
|
91
|
-
|
92
|
-
|
93
|
-
{
|
85
|
+
test "with security section" do
|
86
|
+
valid_attributes = {
|
94
87
|
security: {
|
95
88
|
"0" => {
|
96
89
|
self_hostname: "test.fluentd",
|
@@ -98,9 +91,7 @@ describe Fluentd::Setting::InForward do
|
|
98
91
|
}
|
99
92
|
}
|
100
93
|
}
|
101
|
-
|
102
|
-
let(:expected) {
|
103
|
-
<<-CONFIG
|
94
|
+
expected = <<-CONFIG
|
104
95
|
<source>
|
105
96
|
@type forward
|
106
97
|
<security>
|
@@ -109,13 +100,10 @@ describe Fluentd::Setting::InForward do
|
|
109
100
|
</security>
|
110
101
|
</source>
|
111
102
|
CONFIG
|
112
|
-
|
113
|
-
|
114
|
-
it { should == expected }
|
115
|
-
end
|
103
|
+
assert_equal(expected, @klass.new(valid_attributes).to_config.to_s)
|
104
|
+
end
|
116
105
|
|
117
|
-
|
118
|
-
it do
|
106
|
+
test "with invalid security section" do
|
119
107
|
params = {
|
120
108
|
security: {
|
121
109
|
"0" => {
|
@@ -123,9 +111,9 @@ describe Fluentd::Setting::InForward do
|
|
123
111
|
}
|
124
112
|
}
|
125
113
|
}
|
126
|
-
object = klass.new(params)
|
114
|
+
object = @klass.new(params)
|
127
115
|
object.validate
|
128
|
-
|
116
|
+
assert_equal(["'shared_key' parameter is required, in section security"], object.errors.full_messages)
|
129
117
|
end
|
130
118
|
end
|
131
119
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module Fluentd::Setting
|
4
|
+
class InHttpTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
@klass = Fluentd::Setting::InHttp
|
7
|
+
@instance = @klass.new({})
|
8
|
+
end
|
9
|
+
|
10
|
+
test "#valid?" do
|
11
|
+
assert do
|
12
|
+
@instance.valid?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
test "#plugin_name" do
|
17
|
+
assert_equal("http", @instance.plugin_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
test "#plugin_type" do
|
21
|
+
assert_equal("input", @instance.plugin_type)
|
22
|
+
end
|
23
|
+
|
24
|
+
test "#to_config" do
|
25
|
+
assert do
|
26
|
+
@instance.to_config.to_s.include?("@type http")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module Fluentd::Setting
|
4
|
+
class InMonitorAgentTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
@klass = Fluentd::Setting::InMonitorAgent
|
7
|
+
@instance = @klass.new({})
|
8
|
+
end
|
9
|
+
|
10
|
+
test "#valid?" do
|
11
|
+
assert do
|
12
|
+
@instance.valid?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
test "#plugin_name" do
|
17
|
+
assert_equal("monitor_agent", @instance.plugin_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
test "#plugin_type" do
|
21
|
+
assert_equal("input", @instance.plugin_type)
|
22
|
+
end
|
23
|
+
|
24
|
+
test "#to_config" do
|
25
|
+
assert do
|
26
|
+
@instance.to_config.to_s.include?("@type monitor_agent")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module Fluentd::Setting
|
4
|
+
class InSyslogTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
@klass = Fluentd::Setting::InSyslog
|
7
|
+
@instance = @klass.new({ tag: "foo.bar" })
|
8
|
+
end
|
9
|
+
|
10
|
+
test "#valid?" do
|
11
|
+
assert do
|
12
|
+
@instance.valid?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
test "invalid" do
|
17
|
+
assert do
|
18
|
+
!@klass.new({}).valid?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
test "#plugin_name" do
|
23
|
+
assert_equal("syslog", @instance.plugin_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
test "#plugin_type" do
|
27
|
+
assert_equal("input", @instance.plugin_type)
|
28
|
+
end
|
29
|
+
|
30
|
+
test "#to_config" do
|
31
|
+
assert do
|
32
|
+
@instance.to_config.to_s.include?("@type syslog")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
test "with parse section" do
|
37
|
+
params = {
|
38
|
+
tag: "test",
|
39
|
+
parse_type: "syslog",
|
40
|
+
parse: {
|
41
|
+
"0" => {
|
42
|
+
"type" => "syslog",
|
43
|
+
"message_format" => "rfc5424"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
@instance = @klass.new(params)
|
48
|
+
expected = <<-CONFIG.strip_heredoc
|
49
|
+
<source>
|
50
|
+
@type syslog
|
51
|
+
tag test
|
52
|
+
<parse>
|
53
|
+
@type syslog
|
54
|
+
message_format rfc5424
|
55
|
+
</parse>
|
56
|
+
</source>
|
57
|
+
CONFIG
|
58
|
+
assert_equal(expected, @instance.to_config.to_s)
|
59
|
+
end
|
60
|
+
|
61
|
+
test "with @log_level" do
|
62
|
+
params = {
|
63
|
+
tag: "test",
|
64
|
+
log_level: "debug",
|
65
|
+
parse_type: "syslog",
|
66
|
+
parse: {
|
67
|
+
"0" => {
|
68
|
+
"type" => "syslog",
|
69
|
+
"message_format" => "rfc5424"
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
@instance = @klass.new(params)
|
74
|
+
expected = <<-CONFIG.strip_heredoc
|
75
|
+
<source>
|
76
|
+
@type syslog
|
77
|
+
tag test
|
78
|
+
@log_level debug
|
79
|
+
<parse>
|
80
|
+
@type syslog
|
81
|
+
message_format rfc5424
|
82
|
+
</parse>
|
83
|
+
</source>
|
84
|
+
CONFIG
|
85
|
+
assert_equal(expected, @instance.to_config.to_s)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
module Fluentd::Setting
|
4
|
+
class InTailTest < ActiveSupport::TestCase
|
5
|
+
setup do
|
6
|
+
@klass = Fluentd::Setting::InTail
|
7
|
+
@params = {
|
8
|
+
tag: "dummy.log",
|
9
|
+
path: "/tmp/log/dummy.log",
|
10
|
+
parse_type: "none",
|
11
|
+
parse: {
|
12
|
+
"0" => {
|
13
|
+
"type" => "none"
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
@instance = @klass.new(@params)
|
18
|
+
end
|
19
|
+
|
20
|
+
sub_test_case "#valid?" do
|
21
|
+
test "valid" do
|
22
|
+
assert_true(@instance.valid?)
|
23
|
+
end
|
24
|
+
|
25
|
+
test "invalid if tag is missing" do
|
26
|
+
params = @params.dup
|
27
|
+
params.delete(:tag)
|
28
|
+
assert_false(@klass.new(params).valid?)
|
29
|
+
end
|
30
|
+
|
31
|
+
test "invalid if path is missing" do
|
32
|
+
params = @params.dup
|
33
|
+
params.delete(:path)
|
34
|
+
assert_false(@klass.new(params).valid?)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
test "#plugin_name" do
|
39
|
+
assert_equal("tail", @instance.plugin_name)
|
40
|
+
end
|
41
|
+
|
42
|
+
test "#plugin_type" do
|
43
|
+
assert_equal("input", @instance.plugin_type)
|
44
|
+
end
|
45
|
+
|
46
|
+
test "#to_config" do
|
47
|
+
assert do
|
48
|
+
@instance.to_config.to_s.include?("@type tail")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
require "fluent/plugin/buf_file"
|
4
|
+
|
5
|
+
module Fluentd::Setting
|
6
|
+
class OutElasticsearchTest < ActiveSupport::TestCase
|
7
|
+
setup do
|
8
|
+
@klass = Fluentd::Setting::OutElasticsearch
|
9
|
+
@instance = @klass.new({})
|
10
|
+
end
|
11
|
+
|
12
|
+
test "#valid?" do
|
13
|
+
assert do
|
14
|
+
@instance.valid?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
test "#plugin_name" do
|
19
|
+
assert_equal("elasticsearch", @instance.plugin_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
test "#plugin_type" do
|
23
|
+
assert_equal("output", @instance.plugin_type)
|
24
|
+
end
|
25
|
+
|
26
|
+
test "#to_config" do
|
27
|
+
assert do
|
28
|
+
@instance.to_config.to_s.include?("@type elasticsearch")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "fluent/plugin/buf_file"
|
3
|
+
|
4
|
+
module Fluentd::Setting
|
5
|
+
class OutMongoTest < ActiveSupport::TestCase
|
6
|
+
setup do
|
7
|
+
@klass = Fluentd::Setting::OutMongo
|
8
|
+
@valid_attributes = {
|
9
|
+
pattern: "mongo.*.*",
|
10
|
+
host: "example.com",
|
11
|
+
port: 12345,
|
12
|
+
database: "mongodb",
|
13
|
+
tag_mapped: "true",
|
14
|
+
}
|
15
|
+
@instance = @klass.new(@valid_attributes)
|
16
|
+
end
|
17
|
+
|
18
|
+
sub_test_case "#valid?" do
|
19
|
+
test "invalid if database is missing" do
|
20
|
+
params = @valid_attributes.dup
|
21
|
+
params.delete(:database)
|
22
|
+
instance = @klass.new(params)
|
23
|
+
assert_false(instance.valid?)
|
24
|
+
assert_equal(["connection_string or database parameter is required"], instance.errors.full_messages)
|
25
|
+
end
|
26
|
+
|
27
|
+
test "invalid if collection is missing" do
|
28
|
+
params = {
|
29
|
+
pattern: "mongo.*.*",
|
30
|
+
host: "example.com",
|
31
|
+
port: 12345,
|
32
|
+
database: "mongodb",
|
33
|
+
}
|
34
|
+
instance = @klass.new(params)
|
35
|
+
assert_false(instance.valid?)
|
36
|
+
assert_equal(["normal mode requires collection parameter"], instance.errors.full_messages)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
test "#plugin_name" do
|
41
|
+
assert_equal("mongo", @instance.plugin_name)
|
42
|
+
end
|
43
|
+
|
44
|
+
test "#plugin_type" do
|
45
|
+
assert_equal("output", @instance.plugin_type)
|
46
|
+
end
|
47
|
+
|
48
|
+
test "#to_config" do
|
49
|
+
expected = <<-CONFIG.strip_heredoc
|
50
|
+
<match mongo.*.*>
|
51
|
+
@type mongo
|
52
|
+
database mongodb
|
53
|
+
host example.com
|
54
|
+
port 12345
|
55
|
+
tag_mapped true
|
56
|
+
</match>
|
57
|
+
CONFIG
|
58
|
+
assert_equal(expected, @instance.to_config.to_s)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require "fluent/plugin/buf_file"
|
3
|
+
|
4
|
+
module Fluentd::Setting
|
5
|
+
class OutS3Test < ActiveSupport::TestCase
|
6
|
+
setup do
|
7
|
+
@klass = Fluentd::Setting::OutS3
|
8
|
+
@valid_attributes = {
|
9
|
+
s3_bucket: "bucketname"
|
10
|
+
}
|
11
|
+
@instance = @klass.new(@valid_attributes)
|
12
|
+
end
|
13
|
+
|
14
|
+
sub_test_case "#valid?" do
|
15
|
+
test "valid" do
|
16
|
+
assert_true(@instance.valid?)
|
17
|
+
end
|
18
|
+
|
19
|
+
test "invalid if s3_bucket is missing" do
|
20
|
+
instance = @klass.new({})
|
21
|
+
assert_false(instance.valid?)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
test "#plugin_name" do
|
26
|
+
assert_equal("s3", @instance.plugin_name)
|
27
|
+
end
|
28
|
+
|
29
|
+
test "#plugin_type" do
|
30
|
+
assert_equal("output", @instance.plugin_type)
|
31
|
+
end
|
32
|
+
|
33
|
+
test "#to_config" do
|
34
|
+
assert do
|
35
|
+
@instance.to_config.to_s.include?("@type s3")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
test "with assume_role_credentials" do
|
40
|
+
params = {
|
41
|
+
pattern: "s3.*",
|
42
|
+
s3_bucket: "bucketname",
|
43
|
+
assume_role_credentials: {
|
44
|
+
"0" => {
|
45
|
+
role_arn: "arn",
|
46
|
+
role_session_name: "session_name",
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
expected = <<-CONFIG.strip_heredoc
|
51
|
+
<match s3.*>
|
52
|
+
@type s3
|
53
|
+
s3_bucket bucketname
|
54
|
+
<assume_role_credentials>
|
55
|
+
role_arn arn
|
56
|
+
role_session_name session_name
|
57
|
+
</assume_role_credentials>
|
58
|
+
</match>
|
59
|
+
CONFIG
|
60
|
+
instance = @klass.new(params)
|
61
|
+
assert_equal(expected, instance.to_config.to_s)
|
62
|
+
end
|
63
|
+
|
64
|
+
test "with instance_profile_credentials" do
|
65
|
+
params = {
|
66
|
+
pattern: "s3.*",
|
67
|
+
s3_bucket: "bucketname",
|
68
|
+
instance_profile_credentials: {
|
69
|
+
"0" => {
|
70
|
+
port: 80
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
expected = <<-CONFIG.strip_heredoc
|
75
|
+
<match s3.*>
|
76
|
+
@type s3
|
77
|
+
s3_bucket bucketname
|
78
|
+
<instance_profile_credentials>
|
79
|
+
port 80
|
80
|
+
</instance_profile_credentials>
|
81
|
+
</match>
|
82
|
+
CONFIG
|
83
|
+
instance = @klass.new(params)
|
84
|
+
assert_equal(expected, instance.to_config.to_s)
|
85
|
+
end
|
86
|
+
|
87
|
+
test "with shared_credentials" do
|
88
|
+
params = {
|
89
|
+
pattern: "s3.*",
|
90
|
+
s3_bucket: "bucketname",
|
91
|
+
shared_credentials: {
|
92
|
+
"0" => {
|
93
|
+
path: "$HOME/.aws/credentials",
|
94
|
+
profile_name: "default",
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
expected = <<-CONFIG.strip_heredoc
|
99
|
+
<match s3.*>
|
100
|
+
@type s3
|
101
|
+
s3_bucket bucketname
|
102
|
+
<shared_credentials>
|
103
|
+
path $HOME/.aws/credentials
|
104
|
+
profile_name default
|
105
|
+
</shared_credentials>
|
106
|
+
</match>
|
107
|
+
CONFIG
|
108
|
+
instance = @klass.new(params)
|
109
|
+
assert_equal(expected, instance.to_config.to_s)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|