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
data/spec/models/user_spec.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe User do
|
4
|
-
let(:user) { build(:user) }
|
5
|
-
|
6
|
-
describe "#valid?" do
|
7
|
-
subject { user.valid? }
|
8
|
-
|
9
|
-
describe "password" do
|
10
|
-
before do
|
11
|
-
user.current_password = current_password
|
12
|
-
user.password = password
|
13
|
-
user.password_confirmation = password_confirmation
|
14
|
-
end
|
15
|
-
|
16
|
-
context 'when current_password is correct' do
|
17
|
-
let(:current_password) { user.password }
|
18
|
-
|
19
|
-
context 'when password/confirmation is 8 characters' do
|
20
|
-
let(:password) { 'a' * 8 }
|
21
|
-
let(:password_confirmation) { password }
|
22
|
-
|
23
|
-
it { should be_truthy }
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'when password is 7 characters' do
|
27
|
-
let(:password) { 'a' * 7 }
|
28
|
-
let(:password_confirmation) { password }
|
29
|
-
|
30
|
-
it 'should return false' do
|
31
|
-
should be_falsey
|
32
|
-
user.errors.keys.should == [:password]
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'when password != password_confirmation' do
|
37
|
-
let(:password) { 'a' * 8 }
|
38
|
-
let(:password_confirmation) { 'b' * 8 }
|
39
|
-
|
40
|
-
it 'should return false' do
|
41
|
-
should be_falsey
|
42
|
-
user.errors.keys.should == [:password]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
context 'when current_password is wrong' do
|
48
|
-
let(:current_password) { 'invalid_password' }
|
49
|
-
let(:password) { 'a' * 8 }
|
50
|
-
let(:password_confirmation) { password }
|
51
|
-
|
52
|
-
it 'should return false' do
|
53
|
-
should be_falsey
|
54
|
-
user.errors.keys.should == [:current_password]
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
if ENV['RAILS_ENV'] == 'test'
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.start 'rails'
|
4
|
-
end
|
5
|
-
|
6
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
7
|
-
ENV["RAILS_ENV"] ||= 'test'
|
8
|
-
require File.expand_path("../../config/environment", __FILE__)
|
9
|
-
require 'rspec/rails'
|
10
|
-
require 'webmock/rspec'
|
11
|
-
WebMock.disable_net_connect!(allow_localhost: true)
|
12
|
-
require 'capybara/rspec'
|
13
|
-
Capybara.register_driver :selenium do |app|
|
14
|
-
Capybara::Selenium::Driver.new(app,
|
15
|
-
browser: :chrome,
|
16
|
-
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(
|
17
|
-
chrome_options: {
|
18
|
-
args: %w(headless disable-gpu window-size=1920,1080),
|
19
|
-
},
|
20
|
-
)
|
21
|
-
)
|
22
|
-
end
|
23
|
-
Capybara.javascript_driver = :selenium
|
24
|
-
require 'capybara-screenshot/rspec'
|
25
|
-
|
26
|
-
require "fluent/load"
|
27
|
-
require "fluent/plugin/buf_file"
|
28
|
-
|
29
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
30
|
-
# in spec/support/ and its subdirectories.
|
31
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
32
|
-
Dir[Rails.root.join("spec/*/shared_examples/**/*.rb")].each { |f| require f }
|
33
|
-
|
34
|
-
RSpec.configure do |config|
|
35
|
-
# ## Mock Framework
|
36
|
-
#
|
37
|
-
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
38
|
-
#
|
39
|
-
# config.mock_with :mocha
|
40
|
-
# config.mock_with :flexmock
|
41
|
-
# config.mock_with :rr
|
42
|
-
|
43
|
-
# Syntax sugar to use the FactoryBot methods directly instead FactoryBot.create ete.
|
44
|
-
config.include FactoryBot::Syntax::Methods
|
45
|
-
config.include LoginMacro
|
46
|
-
config.include JavascriptMacro
|
47
|
-
config.include StubDaemon
|
48
|
-
config.include ConfigHistories
|
49
|
-
|
50
|
-
# If true, the base class of anonymous controllers will be inferred
|
51
|
-
# automatically. This will be the default behavior in future versions of
|
52
|
-
# rspec-rails.
|
53
|
-
config.infer_base_class_for_anonymous_controllers = false
|
54
|
-
|
55
|
-
# Run specs in random order to surface order dependencies. If you find an
|
56
|
-
# order dependency and want to debug it, you can fix the order by providing
|
57
|
-
# the seed, which is printed after each run.
|
58
|
-
# --seed 1234
|
59
|
-
config.order = "random"
|
60
|
-
|
61
|
-
# allow `should`
|
62
|
-
config.expect_with :rspec do |c|
|
63
|
-
c.syntax = [:should, :expect]
|
64
|
-
end
|
65
|
-
config.mock_with :rspec do |c|
|
66
|
-
c.syntax = [:should, :expect]
|
67
|
-
end
|
68
|
-
|
69
|
-
# rspec 2.99
|
70
|
-
config.infer_spec_type_from_file_location!
|
71
|
-
|
72
|
-
unless File.directory?("/opt/td-agent")
|
73
|
-
# including td-agent specific tests, so some tests will fail if the system has no td-agent
|
74
|
-
warn "\n\nSkipping td-agent specific tests (system has no td-agent)\n\n"
|
75
|
-
config.filter_run_excluding :td_agent_required => true
|
76
|
-
end
|
77
|
-
|
78
|
-
config.before do
|
79
|
-
$log = DummyLogger.logger
|
80
|
-
end
|
81
|
-
|
82
|
-
config.after(:suite) do
|
83
|
-
FileUtils.rm_rf FluentdUI.data_dir
|
84
|
-
end
|
85
|
-
end
|
@@ -1,57 +0,0 @@
|
|
1
|
-
module ConfigHistories
|
2
|
-
shared_context 'daemon has some config histories' do
|
3
|
-
let!(:three_hours_ago) { Time.zone.now - 3.hours }
|
4
|
-
let(:config_contents) { <<-CONF.strip_heredoc }
|
5
|
-
<source>
|
6
|
-
type forward
|
7
|
-
port 24224
|
8
|
-
</source>
|
9
|
-
CONF
|
10
|
-
|
11
|
-
let(:new_config) { <<-CONF.strip_heredoc }
|
12
|
-
<source>
|
13
|
-
type http
|
14
|
-
port 8899
|
15
|
-
</source>
|
16
|
-
CONF
|
17
|
-
|
18
|
-
before do
|
19
|
-
Timecop.freeze(three_hours_ago)
|
20
|
-
|
21
|
-
#remove backups on each to avoid depending on spec execution order
|
22
|
-
FileUtils.rm_r daemon.agent.config_backup_dir, force: true
|
23
|
-
|
24
|
-
7.times do |i|
|
25
|
-
backpued_time = three_hours_ago - (i + 1).hours
|
26
|
-
FileUtils.touch daemon.agent.config_backup_dir + "/#{backpued_time.strftime('%Y%m%d_%H%M%S')}.conf"
|
27
|
-
end
|
28
|
-
|
29
|
-
Timecop.freeze(three_hours_ago + 1.hour)
|
30
|
-
daemon.agent.config_write config_contents #add before conf
|
31
|
-
|
32
|
-
Timecop.freeze(three_hours_ago + 2.hour)
|
33
|
-
daemon.agent.config_write new_config #update conf
|
34
|
-
|
35
|
-
Timecop.freeze(three_hours_ago + 3.hour)
|
36
|
-
end
|
37
|
-
|
38
|
-
after do
|
39
|
-
FileUtils.rm_r daemon.agent.config_backup_dir, force: true
|
40
|
-
Timecop.return
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
shared_context 'daemon had been started once' do
|
45
|
-
let!(:backup_content){ "Running backup file content" }
|
46
|
-
|
47
|
-
before do
|
48
|
-
File.open(daemon.agent.running_config_backup_file, "w") do |file|
|
49
|
-
file.write(backup_content)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
after do
|
54
|
-
FileUtils.rm_r daemon.agent.running_config_backup_dir, force: true
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,181 +0,0 @@
|
|
1
|
-
shared_examples_for "Fluentd::Agent has common behavior" do |klass|
|
2
|
-
describe "#extra_options" do
|
3
|
-
context "blank" do
|
4
|
-
let(:options) { {} }
|
5
|
-
it { instance.pid_file.should == described_class.default_options[:pid_file] }
|
6
|
-
it { instance.log_file.should == described_class.default_options[:log_file] }
|
7
|
-
it { instance.config_file.should == described_class.default_options[:config_file] }
|
8
|
-
end
|
9
|
-
|
10
|
-
context "given" do
|
11
|
-
let(:options) do
|
12
|
-
{
|
13
|
-
:pid_file => pid_file,
|
14
|
-
:log_file => log_file,
|
15
|
-
:config_file => config_file,
|
16
|
-
}
|
17
|
-
end
|
18
|
-
let(:pid_file) { "pid" }
|
19
|
-
let(:log_file) { "log" }
|
20
|
-
let(:config_file) { "config" }
|
21
|
-
|
22
|
-
it { instance.pid_file.should == pid_file }
|
23
|
-
it { instance.log_file.should == log_file }
|
24
|
-
it { instance.config_file.should == config_file }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "#logged_errors" do
|
29
|
-
before { instance.stub(:log_file).and_return(logfile) }
|
30
|
-
|
31
|
-
describe "#errors_since" do
|
32
|
-
let(:logged_time) { Time.parse('2014-05-27') }
|
33
|
-
let(:now) { Time.parse('2014-05-29') }
|
34
|
-
|
35
|
-
before { Timecop.freeze(now) }
|
36
|
-
after { Timecop.return }
|
37
|
-
|
38
|
-
subject { instance.log.errors_since(days.days.ago) }
|
39
|
-
|
40
|
-
context "has no errors" do
|
41
|
-
let(:logfile) { File.expand_path("./spec/support/fixtures/error0.log", Rails.root) }
|
42
|
-
let(:days) { 100 }
|
43
|
-
|
44
|
-
it "empty array" do
|
45
|
-
should be_empty
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context "has errors" do
|
50
|
-
let(:logfile) { File.expand_path("./spec/support/fixtures/error2.log", Rails.root) }
|
51
|
-
|
52
|
-
context "unreachable since" do
|
53
|
-
let(:days) { 0 }
|
54
|
-
it { should be_empty }
|
55
|
-
end
|
56
|
-
|
57
|
-
context "reachable since" do
|
58
|
-
let(:days) { 100 }
|
59
|
-
|
60
|
-
it "contain stack trace" do
|
61
|
-
subject[0][:subject].should include("Address already in use - bind(2)")
|
62
|
-
end
|
63
|
-
|
64
|
-
it "newer(bottom) is first" do
|
65
|
-
one = Time.parse(subject[0][:subject])
|
66
|
-
two = Time.parse(subject[1][:subject])
|
67
|
-
one.should >= two
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "#recent_errors" do
|
74
|
-
context "have 0 error log" do
|
75
|
-
let(:logfile) { File.expand_path("./spec/support/fixtures/error0.log", Rails.root) }
|
76
|
-
subject { instance.log.recent_errors(2) }
|
77
|
-
|
78
|
-
it "empty array" do
|
79
|
-
should be_empty
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "have 2 error log" do
|
84
|
-
let(:logfile) { File.expand_path("./spec/support/fixtures/error2.log", Rails.root) }
|
85
|
-
subject { instance.log.recent_errors(2) }
|
86
|
-
|
87
|
-
describe "limit" do
|
88
|
-
subject { instance.log.recent_errors(limit).length }
|
89
|
-
|
90
|
-
context "=1" do
|
91
|
-
let(:limit) { 1 }
|
92
|
-
it { should == limit }
|
93
|
-
end
|
94
|
-
|
95
|
-
context "=2" do
|
96
|
-
let(:limit) { 2 }
|
97
|
-
it { should == limit }
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
it "contain stack trace" do
|
102
|
-
subject[0][:subject].should include("Address already in use - bind(2)")
|
103
|
-
end
|
104
|
-
|
105
|
-
it "newer(bottom) is first" do
|
106
|
-
one = Time.parse(subject[0][:subject])
|
107
|
-
two = Time.parse(subject[1][:subject])
|
108
|
-
one.should >= two
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
context "have 3 errors log includeing sequential 2 error log" do
|
113
|
-
let(:logfile) { File.expand_path("./spec/support/fixtures/error3.log", Rails.root) }
|
114
|
-
subject { instance.log.recent_errors(3) }
|
115
|
-
|
116
|
-
it "count 3 errors" do
|
117
|
-
subject[0][:subject].should include("3 Address already in use - bind(2)")
|
118
|
-
subject[0][:notes].size.should be 1
|
119
|
-
subject[1][:subject].should include("2 Address already in use - bind(2)")
|
120
|
-
subject[1][:notes].size.should be 2
|
121
|
-
subject[2][:subject].should include("1 Address already in use - bind(2)")
|
122
|
-
subject[2][:notes].size.should be 0
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "#dryrun" do
|
129
|
-
let(:root) { FluentdUI.data_dir + "/tmp/agentspec/" }
|
130
|
-
let(:dummy_log_file) { root + "dummy.log" }
|
131
|
-
let(:dummy_pid_file) { root + "dummy.pid" }
|
132
|
-
|
133
|
-
before do
|
134
|
-
FileUtils.mkdir_p root
|
135
|
-
instance.stub(:log_file).and_return(dummy_log_file)
|
136
|
-
instance.stub(:pid_file).and_return(dummy_pid_file)
|
137
|
-
end
|
138
|
-
|
139
|
-
describe "valid/invalid" do
|
140
|
-
let(:config_path) { Rails.root.join("tmp", "fluent-test.conf").to_s }
|
141
|
-
before { File.write(config_path, config) }
|
142
|
-
after { File.unlink(config_path) }
|
143
|
-
|
144
|
-
context "valid config" do
|
145
|
-
let(:config) { <<-CONF.strip_heredoc }
|
146
|
-
<source>
|
147
|
-
type forward
|
148
|
-
</source>
|
149
|
-
CONF
|
150
|
-
|
151
|
-
context "with `!`" do
|
152
|
-
subject { instance.dryrun!(config_path) }
|
153
|
-
it { expect { subject }.to_not raise_error }
|
154
|
-
end
|
155
|
-
|
156
|
-
context "without `!`" do
|
157
|
-
subject { instance.dryrun(config_path) }
|
158
|
-
it { should be_truthy }
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
context "invalid config" do
|
163
|
-
let(:config) { <<-CONF.strip_heredoc }
|
164
|
-
<source>
|
165
|
-
type forward
|
166
|
-
CONF
|
167
|
-
|
168
|
-
context "with `!`" do
|
169
|
-
subject { instance.dryrun!(config_path) }
|
170
|
-
it { expect { subject }.to raise_error(Fluentd::Agent::ConfigError) }
|
171
|
-
end
|
172
|
-
|
173
|
-
context "without `!`" do
|
174
|
-
subject { instance.dryrun(config_path) }
|
175
|
-
it { should be_falsy }
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
@@ -1,94 +0,0 @@
|
|
1
|
-
shared_examples_for "Restart strategy" do
|
2
|
-
before { instance.stub(:running?).and_return(running) }
|
3
|
-
subject { instance.restart }
|
4
|
-
|
5
|
-
context "not running" do
|
6
|
-
before { instance.stub(:start).and_return(start) }
|
7
|
-
|
8
|
-
let(:running) { false }
|
9
|
-
|
10
|
-
context "#start success" do
|
11
|
-
let(:start) { true }
|
12
|
-
it { should be_truthy }
|
13
|
-
end
|
14
|
-
|
15
|
-
context "#start failed" do
|
16
|
-
let(:start) { false }
|
17
|
-
it { should be_falsy }
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "running" do
|
22
|
-
before { instance.stub(:stop).and_return(stop_result) }
|
23
|
-
before { instance.stub(:start).and_return(start_result) }
|
24
|
-
before { instance.stub(:validate_fluentd_options).and_return(validate_result) }
|
25
|
-
|
26
|
-
let(:running) { true }
|
27
|
-
|
28
|
-
describe "return true only if #stop and #start success" do
|
29
|
-
context "#validate_fluentd_options success" do
|
30
|
-
let(:validate_result) { true }
|
31
|
-
|
32
|
-
context "#stop success" do
|
33
|
-
let(:stop_result) { true }
|
34
|
-
|
35
|
-
context" #start success" do
|
36
|
-
let(:start_result) { true }
|
37
|
-
it { should be_truthy }
|
38
|
-
end
|
39
|
-
|
40
|
-
context" #start fail" do
|
41
|
-
let(:start_result) { false }
|
42
|
-
it { should be_falsy }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "#stop fail" do
|
47
|
-
let(:stop_result) { false }
|
48
|
-
|
49
|
-
context" #start success" do
|
50
|
-
let(:start_result) { true }
|
51
|
-
it { should be_falsy }
|
52
|
-
end
|
53
|
-
|
54
|
-
context" #start fail" do
|
55
|
-
let(:start_result) { false }
|
56
|
-
it { should be_falsy }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "#validate_fluentd_options failed" do
|
62
|
-
let(:validate_result) { false }
|
63
|
-
|
64
|
-
context "#stop success" do
|
65
|
-
let(:stop_result) { true }
|
66
|
-
|
67
|
-
context" #start success" do
|
68
|
-
let(:start_result) { true }
|
69
|
-
it { should be_falsy }
|
70
|
-
end
|
71
|
-
|
72
|
-
context" #start fail" do
|
73
|
-
let(:start_result) { false }
|
74
|
-
it { should be_falsy }
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
context "#stop fail" do
|
79
|
-
let(:stop_result) { false }
|
80
|
-
|
81
|
-
context" #start success" do
|
82
|
-
let(:start_result) { true }
|
83
|
-
it { should be_falsy }
|
84
|
-
end
|
85
|
-
|
86
|
-
context" #start fail" do
|
87
|
-
let(:start_result) { false }
|
88
|
-
it { should be_falsy }
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|