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.

Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +24 -0
  3. data/Gemfile +5 -3
  4. data/Gemfile.lock +88 -75
  5. data/README.md +11 -0
  6. data/Rakefile +1 -1
  7. data/app/javascript/packs/aws_credential.js +1 -1
  8. data/app/javascript/packs/in_tail_parse.js +1 -1
  9. data/app/javascript/packs/owned_plugin_form.js +1 -1
  10. data/app/javascript/packs/settings.js +20 -9
  11. data/app/javascript/packs/transport_config.js +1 -1
  12. data/app/javascript/packs/transport_section.js +1 -1
  13. data/app/javascript/packs/treeview.js +2 -2
  14. data/app/models/plugin.rb +2 -2
  15. data/app/views/fluentd/settings/source_and_output.html.haml +12 -10
  16. data/app/views/layouts/application.html.erb +3 -0
  17. data/app/views/plugins/recommended.html.haml +3 -0
  18. data/app/views/plugins/updated.html.haml +5 -6
  19. data/config.ru +3 -1
  20. data/config/application.rb +1 -1
  21. data/config/application.yml +104 -31
  22. data/config/locales/translation_en.yml +1 -0
  23. data/config/locales/translation_ja.yml +1 -0
  24. data/gemfiles/ruby2.2.gemfile +2 -1
  25. data/lib/fluentd-ui/version.rb +1 -1
  26. data/test/application_system_test_case.rb +8 -0
  27. data/test/controllers/application_controller_test.rb +42 -0
  28. data/test/controllers/fluentd/agents_controller_test.rb +39 -0
  29. data/test/controllers/misc_controller_test.rb +70 -0
  30. data/test/controllers/polling_controller_test.rb +29 -0
  31. data/test/decorators/plugin_decorator_test.rb +26 -0
  32. data/{spec → test}/factories/fluentd.rb +0 -0
  33. data/{spec → test}/factories/plugins.rb +0 -0
  34. data/{spec → test}/factories/user.rb +0 -0
  35. data/{spec/support → test}/fixtures/error0.log +0 -0
  36. data/{spec/support → test}/fixtures/error2.log +0 -0
  37. data/{spec/support → test}/fixtures/error3.log +0 -0
  38. data/{spec/support → test}/fixtures/error4.log +0 -0
  39. data/{spec/support → test}/fixtures/multiline_example.log +0 -0
  40. data/test/integration/dashboard_test.rb +57 -0
  41. data/test/integration/fluentd/setting/histories_test.rb +139 -0
  42. data/test/integration/fluentd/setting/notes_test.rb +27 -0
  43. data/test/integration/fluentd/setting/running_backup_test.rb +65 -0
  44. data/test/integration/fluentd_ui_update_checking_test.rb +27 -0
  45. data/test/integration/sesstions_test.rb +56 -0
  46. data/test/integration/setting_test.rb +126 -0
  47. data/test/integration/users_test.rb +43 -0
  48. data/test/lib/filte_reverse_reader_test.rb +63 -0
  49. data/test/lib/fluentd_ui_test.rb +36 -0
  50. data/test/lib/regexp_preview/multi_line_test.rb +86 -0
  51. data/test/lib/regexp_preview/single_line_test.rb +87 -0
  52. data/test/models/fluent_gem_test.rb +76 -0
  53. data/test/models/fluentd/agent_test.rb +331 -0
  54. data/{spec/models/fluentd/setting/in_forward_spec.rb → test/models/fluentd/setting/in_forward_test.rb} +32 -44
  55. data/test/models/fluentd/setting/in_http_test.rb +30 -0
  56. data/test/models/fluentd/setting/in_monitor_agent_test.rb +30 -0
  57. data/test/models/fluentd/setting/in_syslog_test.rb +88 -0
  58. data/test/models/fluentd/setting/in_tail_test.rb +52 -0
  59. data/test/models/fluentd/setting/out_elasticsearch_test.rb +32 -0
  60. data/test/models/fluentd/setting/out_mongo_test.rb +61 -0
  61. data/test/models/fluentd/setting/out_s3_test.rb +112 -0
  62. data/test/models/fluentd/setting/out_stdout_test.rb +32 -0
  63. data/test/models/fluentd/setting/out_tdlog_test.rb +60 -0
  64. data/test/models/fluentd_log_test.rb +140 -0
  65. data/test/models/fluentd_test.rb +185 -0
  66. data/test/models/plugin_test.rb +144 -0
  67. data/test/models/user_test.rb +48 -0
  68. data/test/support/config_histories.rb +72 -0
  69. data/test/support/configurable_daemon_settings.rb +26 -0
  70. data/test/support/login_macro.rb +12 -0
  71. data/test/support/login_required.rb +8 -0
  72. data/test/support/stub_daemon.rb +14 -0
  73. data/test/system/fluentd/setting/in_forward_test.rb +13 -0
  74. data/test/system/fluentd/setting/in_http_test.rb +13 -0
  75. data/test/system/fluentd/setting/in_monitor_agent.rb +13 -0
  76. data/test/system/fluentd/setting/out_elasticsearch_test.rb +32 -0
  77. data/test/system/fluentd/setting/out_forward_test.rb +41 -0
  78. data/test/system/fluentd/setting/out_stdout_test.rb +15 -0
  79. data/test/system/fluentd/setting/out_tdlog_test.rb +15 -0
  80. data/test/system/source_and_output_test.rb +184 -0
  81. data/test/test_helper.rb +34 -0
  82. metadata +147 -161
  83. data/spec/controllers/application_controller_spec.rb +0 -84
  84. data/spec/controllers/fluentd/agents_controller_spec.rb +0 -61
  85. data/spec/controllers/misc_controller_spec.rb +0 -68
  86. data/spec/controllers/polling_controller_spec.rb +0 -39
  87. data/spec/controllers/sessions_controller_spec.rb +0 -5
  88. data/spec/decorators/plugin_decorator_spec.rb +0 -37
  89. data/spec/features/dashboard_spec.rb +0 -42
  90. data/spec/features/fluentd/setting/histories_spec.rb +0 -110
  91. data/spec/features/fluentd/setting/in_forward_spec.rb +0 -6
  92. data/spec/features/fluentd/setting/in_http_spec.rb +0 -6
  93. data/spec/features/fluentd/setting/in_monitor_agent_spec.rb +0 -6
  94. data/spec/features/fluentd/setting/notes_spec.rb +0 -27
  95. data/spec/features/fluentd/setting/out_forward_spec.rb +0 -38
  96. data/spec/features/fluentd/setting/out_stdout_spec.rb +0 -6
  97. data/spec/features/fluentd/setting/running_backup_spec.rb +0 -106
  98. data/spec/features/fluentd_status_spec.rb +0 -36
  99. data/spec/features/fluentd_ui_update_available_spec.rb +0 -33
  100. data/spec/features/out_elasticsearch_spec.rb +0 -28
  101. data/spec/features/out_forward_spec.rb +0 -36
  102. data/spec/features/out_tdlog_spec.rb +0 -26
  103. data/spec/features/sessions_spec.rb +0 -79
  104. data/spec/features/setting_spec.rb +0 -95
  105. data/spec/features/shared_examples/configurable_daemon_settings.rb +0 -17
  106. data/spec/features/shared_examples/login_required.rb +0 -4
  107. data/spec/features/source_and_output_spec.rb +0 -158
  108. data/spec/features/users_spec.rb +0 -53
  109. data/spec/grok_converter_spec.rb +0 -50
  110. data/spec/lib/file_reverse_reader_spec.rb +0 -93
  111. data/spec/lib/fluentd-ui_spec.rb +0 -35
  112. data/spec/lib/regexp_preview/multi_line_spec.rb +0 -111
  113. data/spec/lib/regexp_preview/single_line_spec.rb +0 -185
  114. data/spec/models/fluent_gem_spec.rb +0 -104
  115. data/spec/models/fluentd/agent/common_spec.rb +0 -82
  116. data/spec/models/fluentd/agent_spec.rb +0 -134
  117. data/spec/models/fluentd/setting/in_http_spec.rb +0 -31
  118. data/spec/models/fluentd/setting/in_monitor_agent_spec.rb +0 -31
  119. data/spec/models/fluentd/setting/in_syslog_spec.rb +0 -98
  120. data/spec/models/fluentd/setting/in_tail_spec.rb +0 -53
  121. data/spec/models/fluentd/setting/out_elasticsearch_spec.rb +0 -31
  122. data/spec/models/fluentd/setting/out_mongo_spec.rb +0 -62
  123. data/spec/models/fluentd/setting/out_s3_spec.rb +0 -128
  124. data/spec/models/fluentd/setting/out_stdout_spec.rb +0 -31
  125. data/spec/models/fluentd/setting/out_tdlog_spec.rb +0 -46
  126. data/spec/models/fluentd_log_spec.rb +0 -171
  127. data/spec/models/fluentd_spec.rb +0 -164
  128. data/spec/models/plugin_spec.rb +0 -191
  129. data/spec/models/user_spec.rb +0 -59
  130. data/spec/spec_helper.rb +0 -85
  131. data/spec/support/config_histories.rb +0 -57
  132. data/spec/support/fluentd_agent_common_behavior.rb +0 -181
  133. data/spec/support/fluentd_agent_restart_strategy.rb +0 -94
  134. data/spec/support/javascript_macro.rb +0 -21
  135. data/spec/support/login_macro.rb +0 -10
  136. data/spec/support/stub_daemon.rb +0 -12
@@ -1,185 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RegexpPreview::SingleLine do
4
- describe ".initialize" do
5
- subject { RegexpPreview::SingleLine.new("log_file.log", plugin_name, plugin_config) }
6
-
7
- describe "parse" do
8
- let :plugin_config do
9
- {}
10
- end
11
-
12
- shared_examples "should create parser plugin instance from selected plugin name" do
13
- it do
14
- expect(subject.plugin).to(be_an_instance_of(plugin_class))
15
- end
16
- end
17
-
18
- context "regexp" do
19
- let(:plugin_name) { "regexp" }
20
- let(:plugin_class) { Fluent::Plugin::RegexpParser }
21
- let :plugin_config do
22
- {
23
- "expression" => "(?<category>\[.+\])",
24
- "time_format" => "%y/%m/%d",
25
- }
26
- end
27
- include_examples("should create parser plugin instance from selected plugin name")
28
- end
29
-
30
- context "ltsv" do
31
- let(:plugin_name) { "ltsv" }
32
- let(:plugin_class) { Fluent::Plugin::LabeledTSVParser }
33
-
34
- include_examples("should create parser plugin instance from selected plugin name")
35
- end
36
-
37
- context "json" do
38
- let(:plugin_name) { "json" }
39
- let(:plugin_class) { Fluent::Plugin::JSONParser }
40
-
41
- include_examples("should create parser plugin instance from selected plugin name")
42
- end
43
-
44
- context "csv" do
45
- let(:plugin_name) { "csv" }
46
- let(:plugin_class) { Fluent::Plugin::CSVParser }
47
- let(:plugin_config) do
48
- {
49
- "keys" => "column1,column2"
50
- }
51
- end
52
-
53
- include_examples("should create parser plugin instance from selected plugin name")
54
- end
55
-
56
- context "tsv" do
57
- let(:plugin_name) { "tsv" }
58
- let(:plugin_class) { Fluent::Plugin::TSVParser }
59
- let(:plugin_config) do
60
- {
61
- "keys" => "column1,column2"
62
- }
63
- end
64
-
65
- include_examples("should create parser plugin instance from selected plugin name")
66
- end
67
-
68
- context "syslog" do # "apache", "nginx", etc
69
- let(:plugin_name) { "syslog" }
70
- let(:plugin_class) { Fluent::Plugin::SyslogParser }
71
-
72
- include_examples("should create parser plugin instance from selected plugin name")
73
- end
74
-
75
- context "apache" do
76
- let(:plugin_name) { "apache" }
77
- let(:plugin_class) { Fluent::Plugin::ApacheParser }
78
-
79
- include_examples("should create parser plugin instance from selected plugin name")
80
- end
81
-
82
- context "nginx" do
83
- let(:plugin_name) { "nginx" }
84
- let(:plugin_class) { Fluent::Plugin::NginxParser }
85
-
86
- include_examples("should create parser plugin instance from selected plugin name")
87
- end
88
- end
89
- end
90
-
91
- describe "#matches" do
92
- let(:logfile) { File.expand_path(logfile_path, Rails.root) }
93
- subject { RegexpPreview::SingleLine.new(logfile, plugin_name, plugin_config).matches }
94
-
95
- describe "parse" do
96
- context "regexp" do
97
- let(:plugin_name) { "regexp" }
98
- let(:logfile_path) { "./spec/support/fixtures/error0.log" }
99
- let :plugin_config do
100
- {
101
- "expression" => "(?<regexp>bar)", # bar from error0.log
102
- "time_format" => "time_format",
103
- }
104
- end
105
-
106
- it 'should have regexp only in [:params][:setting]' do
107
- expect(subject[:pluginConfig]).to eq plugin_config
108
- end
109
-
110
- it 'should include matches info' do
111
- matches_info = {
112
- whole: "bar",
113
- matches: [
114
- { key: "regexp", matched: "bar", pos: [0, 3] }
115
- ]
116
- }
117
- expect(subject[:matches]).to include matches_info
118
- end
119
- end
120
-
121
- context "csv" do
122
- let(:plugin_name) { "csv" }
123
- let(:logfile_path) { "./spec/support/fixtures/error0.log" }
124
- let :plugin_config do
125
- {
126
- "keys" => "column1,column2"
127
- }
128
- end
129
-
130
- it 'should not have matches_info' do
131
- expect(subject[:matches]).to be_empty
132
- end
133
- end
134
-
135
- context "syslog" do
136
- let(:logfile_path) { "./spec/support/fixtures/error4.log" }
137
- let(:plugin_name) { "syslog" }
138
- let(:plugin_config) do
139
- {
140
- "time_format" => "%Y-%m-%d %H:%M:%S %z",
141
- "keep_time_key" => true
142
- }
143
- end
144
-
145
- it 'should include matches info' do
146
- matches_info = {
147
- whole: "2014-05-27 10:54:37 +0900 [info]: listening fluent socket on 0.0.0.0:24224",
148
- matches: [
149
- { key: "time", matched: "2014-05-27 10:54:37 +0900", pos: [0, 25] },
150
- { key: "host", matched: "[info]:", pos: [26, 33] },
151
- { key: "ident", matched: "listening", pos: [34, 43] },
152
- { key: "message", matched: "24224", pos: [69, 74] }
153
- ]
154
- }
155
-
156
- expect(subject[:matches]).to include matches_info
157
- end
158
- end
159
-
160
- context "syslog when keep_time_key is false" do
161
- let(:logfile_path) { "./spec/support/fixtures/error4.log" }
162
- let(:plugin_name) { "syslog" }
163
- let(:plugin_config) do
164
- {
165
- "time_format" => "%Y-%m-%d %H:%M:%S %z",
166
- "keep_time_key" => false
167
- }
168
- end
169
-
170
- it 'should include matches info' do
171
- matches_info = {
172
- whole: "2014-05-27 10:54:37 +0900 [info]: listening fluent socket on 0.0.0.0:24224",
173
- matches: [
174
- { key: "host", matched: "[info]:", pos: [26, 33] },
175
- { key: "ident", matched: "listening", pos: [34, 43] },
176
- { key: "message", matched: "24224", pos: [69, 74] }
177
- ]
178
- }
179
-
180
- expect(subject[:matches]).to include matches_info
181
- end
182
- end
183
- end
184
- end
185
- end
@@ -1,104 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe FluentGem do
4
- describe "#install" do
5
- let(:gem) { FluentGem.gem }
6
-
7
- context "no argument" do
8
- after { FluentGem.install }
9
- it { FluentGem.should_receive(:run).with("install") }
10
- end
11
-
12
- context "with arguments" do
13
- after { FluentGem.install(*args) }
14
-
15
- context "1" do
16
- let(:args) { ["plugin-foo"] }
17
- it { FluentGem.should_receive(:run).with("install", *args) }
18
- end
19
-
20
- context "2" do
21
- let(:args) { ["plugin-foo", "--no-document"] }
22
- it { FluentGem.should_receive(:run).with("install", *args) }
23
- end
24
- end
25
- end
26
-
27
- describe "#uninstall" do
28
- let(:gem) { FluentGem.gem }
29
-
30
- context "no argument" do
31
- after { FluentGem.uninstall }
32
- it { FluentGem.should_receive(:run).with("uninstall") }
33
- end
34
-
35
- context "with arguments" do
36
- after { FluentGem.uninstall(*args) }
37
-
38
- context "1" do
39
- let(:args) { ["plugin-foo"] }
40
- it { FluentGem.should_receive(:run).with("uninstall", *args) }
41
- end
42
-
43
- context "2" do
44
- let(:args) { ["plugin-foo", "--no-document"] }
45
- it { FluentGem.should_receive(:run).with("uninstall", *args) }
46
- end
47
- end
48
- end
49
-
50
- describe "#list" do
51
- before { FluentGem.stub(:`).and_return(gem_list) }
52
- subject { FluentGem.list }
53
-
54
- context "no list" do
55
- let(:gem_list) { "" }
56
- it { subject.to_a.should == [] }
57
- end
58
-
59
- context "some lines" do
60
- let(:gem_list) { <<-GEM.strip_heredoc }
61
- dummy (3.3.3)
62
- fluent-plugin-foo (0.1.2)
63
- more_dummy (0.0.1)
64
- GEM
65
- it { subject.to_a.should == gem_list.lines.to_a }
66
- end
67
- end
68
-
69
- describe "#run" do
70
- before { FluentGem.stub(:system).and_return(ret) }
71
- let(:args) { ["install", "foobar"] }
72
-
73
- describe "success" do
74
- let(:ret) { true }
75
- after { FluentGem.run(*args) }
76
- it { FluentGem.should_receive(:system) }
77
- end
78
-
79
- describe "failed" do
80
- let(:ret) { false }
81
- it { expect{ FluentGem.run(*args) }.to raise_error(FluentGem::GemError) }
82
- end
83
- end
84
-
85
- describe "#gem" do
86
- before { Fluentd.stub(:instance).and_return(instance) }
87
- subject { FluentGem.gem }
88
-
89
- context "any instance not setup yet" do
90
- let(:instance) { nil }
91
- it { should == "fluent-gem" }
92
- end
93
-
94
- context "fluentd setup" do
95
- let(:instance) { Fluentd.new(id: nil, variant: "fluentd_gem", log_file: "dummy.log", pid_file: "dummy.pid", config_file: "dummy.conf") }
96
- it { should == "fluent-gem" }
97
- end
98
-
99
- context "td-agent 2 setup" do
100
- let(:instance) { Fluentd.new(id: nil, variant: "td_agent", log_file: "dummy.log", pid_file: "dummy.pid", config_file: "dummy.conf") }
101
- it { should == FluentGem.detect_td_agent_gem }
102
- end
103
- end
104
- end
@@ -1,82 +0,0 @@
1
- require 'spec_helper'
2
- require 'fileutils'
3
-
4
- describe 'Fluentd::Agent::Common' do
5
- let!(:now) { Time.zone.now }
6
- before { Timecop.freeze(now) }
7
- after { Timecop.return }
8
-
9
- subject { target_class.new.tap{|t| t.pid_file = pid_file_path} }
10
-
11
- let!(:target_class) { Struct.new(:pid_file){ include Fluentd::Agent::Common } }
12
- let!(:pid_file_path) { Rails.root.join('tmp', 'fluentd-test', 'local_common_test.pid').to_s }
13
-
14
- describe '#pid' do
15
- context 'no pid file exists' do
16
- it "should be nil" do
17
- expect(subject.pid).to be_nil
18
- end
19
- end
20
-
21
- context 'empty pid file given' do
22
- before { FileUtils.touch pid_file_path }
23
- after { FileUtils.rm pid_file_path }
24
-
25
- it "should be nil" do
26
- expect(subject.pid).to be_nil
27
- end
28
- end
29
-
30
- context 'valid pid file given' do
31
- before { File.write pid_file_path, '9999' }
32
- after { FileUtils.rm pid_file_path }
33
-
34
- it "should be 9999" do
35
- expect(subject.pid).to eq(9999)
36
- end
37
- end
38
- end
39
-
40
- describe '#config_write', stub: :daemon do
41
- let(:config_contents) { <<-CONF.strip_heredoc }
42
- <source>
43
- type forward
44
- port 24224
45
- </source>
46
- CONF
47
-
48
- let(:new_config) { <<-CONF.strip_heredoc }
49
- <source>
50
- type http
51
- port 8899
52
- </source>
53
- CONF
54
-
55
- before do
56
- # other specs could be write in this dir, so clean that in `before`
57
- FileUtils.rm_r daemon.agent.config_backup_dir, force: true
58
- ::Settings.max_backup_files_count.times do |i|
59
- backuped_time = now - (i + 1).hours
60
- FileUtils.touch File.join(daemon.agent.config_backup_dir , "#{backuped_time.strftime('%Y%m%d_%H%M%S')}.conf")
61
- end
62
-
63
- daemon.agent.config_write config_contents #add before conf
64
- daemon.agent.config_write new_config #update conf
65
- end
66
-
67
- after do
68
- FileUtils.rm_r daemon.agent.config_backup_dir, force: true
69
- end
70
-
71
- it 'backed up old conf' do
72
- backup_file = File.join(daemon.agent.config_backup_dir, "#{now.strftime('%Y%m%d_%H%M%S')}.conf")
73
- expect(File.exists? backup_file).to be_truthy
74
- expect(File.read(backup_file)).to eq config_contents
75
- end
76
-
77
- it 'keep files num up to max' do
78
- backup_files = Dir.glob("#{daemon.agent.config_backup_dir}/*").sort
79
- expect(backup_files.size).to eq ::Settings.max_backup_files_count
80
- end
81
- end
82
- end
@@ -1,134 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Fluentd::Agent do
4
- let(:instance) { described_class.new(options) }
5
- let(:options) {
6
- {
7
- :config_file => Rails.root.join('tmp', 'fluentd-test', 'fluentd.conf').to_s
8
- }
9
- }
10
-
11
- describe "FluentdGem" do
12
- let(:described_class) { Fluentd::Agent::FluentdGem } # override nested described_class behavior as https://github.com/rspec/rspec-core/issues/1114
13
-
14
- it_should_behave_like "Fluentd::Agent has common behavior"
15
-
16
- describe "#options_to_argv" do
17
- subject { instance.send(:options_to_argv) }
18
- it { should include("-c #{instance.config_file}") }
19
- it { should include("-d #{instance.pid_file}") }
20
- it { should include("-o #{instance.log_file}") }
21
- end
22
-
23
- describe "#start" do
24
- before { instance.config_write "" } # ensure valid config
25
- before { instance.stub(:running?).and_return(running) }
26
-
27
- context "running" do
28
- let(:running) { true }
29
-
30
- subject { instance.start }
31
-
32
- it { should be_truthy }
33
- end
34
-
35
- context "not running" do
36
- let(:running) { false }
37
-
38
- subject { instance.start }
39
-
40
- before do
41
- instance.stub(:actual_start).and_return(start_result)
42
- end
43
-
44
- context "actual start success" do
45
- after do
46
- FileUtils.rm_r instance.running_config_backup_dir, force: true
47
- end
48
-
49
- let(:start_result) { true }
50
- it { should be_truthy }
51
-
52
- it 'backed up running conf' do
53
- subject
54
- backup_file = instance.running_config_backup_file
55
- expect(File.exists? backup_file).to be_truthy
56
- expect(File.read(backup_file)).to eq File.read(instance.config_file)
57
- end
58
- end
59
-
60
- context "actual start failed" do
61
- let(:start_result) { false }
62
- it { should be_falsy }
63
- end
64
- end
65
- end
66
-
67
- describe "#stop" do
68
- before { instance.stub(:running?).and_return(running) }
69
-
70
- subject { instance.stop }
71
-
72
- context "running" do
73
- let(:running) { true }
74
-
75
- before { instance.stub(:actual_stop).and_return(stop_result) }
76
-
77
- context "actual stop success" do
78
- let(:stop_result) { true }
79
- it { should be_truthy }
80
- end
81
-
82
- context "actual stop failed" do
83
- let(:stop_result) { false }
84
- it { should be_falsy }
85
- end
86
- end
87
-
88
- context "not running" do
89
- let(:running) { false }
90
-
91
- it { should be_truthy }
92
- end
93
- end
94
-
95
- describe "#restart" do
96
- it_should_behave_like "Restart strategy"
97
- end
98
- end
99
-
100
- describe "TdAgent", td_agent_required: true do
101
- let(:described_class) { Fluentd::Agent::TdAgent } # override nested described_class behavior as https://github.com/rspec/rspec-core/issues/1114
102
-
103
- it_should_behave_like "Fluentd::Agent has common behavior"
104
-
105
- describe "#backup_running_config" do
106
- before do
107
- instance.stub(:detached_command).and_return(true)
108
- instance.stub(:pid_from_launchctl).and_return(true)
109
- instance.config_write "" # ensure valid config
110
- end
111
-
112
- after do
113
- FileUtils.rm_r instance.running_config_backup_dir, force: true
114
- end
115
-
116
- let(:options) do
117
- {
118
- :config_file => Rails.root.join('tmp', 'fluentd-test', 'fluentd.conf').to_s
119
- }
120
- end
121
-
122
- before do
123
- instance.start
124
- end
125
-
126
- it 'backed up running conf' do
127
- backup_file = instance.running_config_backup_file
128
- expect(File.exists? backup_file).to be_truthy
129
- expect(File.read(backup_file)).to eq File.read(instance.config_file)
130
- end
131
- end
132
- end
133
- end
134
-