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,6 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "out_stdout", js: true, stub: :daemon do
4
- before { login_with exists_user }
5
- it_should_behave_like "configurable daemon settings", "out_stdout", "pattern", "stdout.**"
6
- end
@@ -1,106 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "running_backup", stub: :daemon do
4
- let!(:exists_user) { build(:user) }
5
- include_context 'daemon has some config histories'
6
-
7
- before do
8
- login_with exists_user
9
- end
10
-
11
- context 'has no running backup file' do
12
- before do
13
- visit '/daemon/setting/running_backup'
14
- end
15
-
16
- describe 'show' do
17
- it 'has no content, no reuse bottun' do
18
- expect(page).to have_text(I18n.t('fluentd.common.never_started_yet', brand: 'fluentd'))
19
- expect(page).not_to have_css('pre')
20
- expect(page).not_to have_text(I18n.t("terms.reuse"))
21
- end
22
- end
23
- end
24
-
25
- context 'has running backup file' do
26
- include_context 'daemon had been started once'
27
-
28
- before do
29
- visit '/daemon/setting/running_backup'
30
- end
31
-
32
- describe 'show' do
33
- it 'has content, reuse bottun' do
34
- expect(page).not_to have_text(I18n.t('fluentd.common.never_started_yet', brand: 'fluentd'))
35
- expect(page).to have_text(backup_content)
36
- expect(page).to have_text(I18n.t("terms.reuse"))
37
- end
38
-
39
- describe 'diff' do
40
- context 'has diff' do
41
- it 'shows diff between current and running' do
42
- diff = page.first(".diff pre").native.inner_text
43
- expect(diff).to include("- type http")
44
- expect(diff).to include("- port 8899")
45
- expect(diff).to include("+ Running backup file content")
46
- end
47
- end
48
-
49
- context 'has no diff' do
50
- before do
51
- daemon.agent.config_write backup_content
52
- visit '/daemon/setting/running_backup'
53
- end
54
-
55
- it 'shows no diff message' do
56
- page.should have_text(I18n.t('messages.no_diff'))
57
- end
58
- end
59
- end
60
-
61
- it 'update config and redirect to setting#show' do
62
- click_link I18n.t("terms.reuse")
63
-
64
- page.should have_css('h1', text: I18n.t('fluentd.settings.show.page_title'))
65
- page.should have_text(I18n.t('messages.config_successfully_copied', brand: 'fluentd') )
66
- page.should have_text(backup_content)
67
- end
68
-
69
- describe "configtest" do
70
- let(:backup_content){ config }
71
- let(:daemon) { build(:fluentd, variant: "fluentd_gem") } # To use fluentd_gem for real dry-run checking
72
- before do
73
- click_link I18n.t("terms.configtest")
74
- end
75
-
76
- context "invalid configfile" do
77
- let(:config) { <<-CONFIG }
78
- <source>
79
- type aaaaaaaaaaaa
80
- </source>
81
- CONFIG
82
-
83
- it do
84
- page.should_not have_css('.alert-success')
85
- page.should have_css('.alert-danger')
86
- page.should have_text(%Q|Unknown input plugin 'aaaaaaaaaaaa'|)
87
- end
88
- end
89
-
90
- context "valid configfile" do
91
- let(:config) { <<-CONFIG }
92
- <source>
93
- type syslog
94
- tag syslog
95
- </source>
96
- CONFIG
97
-
98
- it do
99
- page.should have_css('.alert-success')
100
- page.should_not have_css('.alert-danger')
101
- end
102
- end
103
- end
104
- end
105
- end
106
- end
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'dashboard' do
4
- let!(:exists_user) { build(:user) }
5
-
6
- before { login_with exists_user }
7
-
8
- context 'no configuration' do
9
- before { visit '/' }
10
-
11
- it do
12
- page.should_not have_css(".fluentd-status")
13
- end
14
- end
15
-
16
- context 'fluentd is stop', stub: :daemon do
17
- before { visit '/' }
18
-
19
- it do
20
- page.should have_css(".fluentd-status .stopped")
21
- end
22
- end
23
-
24
- context 'fluentd is running', stub: :daemon do
25
- before do
26
- # XXX i have no idea to not use stub...
27
- Fluentd::Agent::TdAgent.any_instance.stub(:running?).and_return(true)
28
-
29
- visit '/'
30
- end
31
-
32
- it do
33
- page.should have_css(".fluentd-status .running")
34
- end
35
- end
36
- end
@@ -1,33 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "fluentd-ui updates checking" do
4
- let(:exists_user) { build(:user) }
5
- before { login_with(exists_user) }
6
-
7
- describe "Show popup if newer version is available" do
8
- let(:version) { "9999.99" }
9
- let(:message) { I18n.t("messages.available_new_fluentd_ui", version: FluentdUI.latest_version, update_url: misc_information_path, title: "dummy") }
10
- before { FluentdUI.latest_version = version }
11
- after { FluentdUI.latest_version = ::FluentdUI::VERSION }
12
-
13
- it do
14
- visit root_path
15
- page.should have_css('.alert-info')
16
- page.should have_content(version)
17
- page.body.should include(message)
18
- end
19
- end
20
-
21
- describe "Not shown popup if newer version is not available" do
22
- let(:version) { ::FluentdUI::VERSION }
23
- let(:message) { I18n.t("messages.available_new_fluentd_ui", version: FluentdUI.latest_version, update_url: misc_information_path, title: "dummy") }
24
-
25
- it do
26
- visit root_path
27
- page.should_not have_css('.alert-info')
28
- page.should_not have_content(version)
29
- page.body.should_not include(message)
30
- end
31
- end
32
-
33
- end
@@ -1,28 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "out_elasticsearch", stub: :daemon do
4
- let(:exists_user) { build(:user) }
5
- let(:match) { "test.out_forward.#{Time.now.to_i}.*" }
6
- let(:location) { daemon_setting_out_elasticsearch_path }
7
-
8
- before do
9
- login_with exists_user
10
- end
11
-
12
- it "Shown form" do
13
- visit location
14
- page.should have_css('input[name="setting[pattern]"]')
15
- end
16
-
17
- it "Updated config after submit", js: true do
18
- daemon.agent.config.should_not include(match)
19
- visit location
20
- within('form') do
21
- fill_in "Pattern", with: match
22
- fill_in "Index name", with: "index"
23
- fill_in "Type name", with: "type_name"
24
- end
25
- click_button I18n.t("fluentd.common.finish")
26
- daemon.agent.config.should include(match)
27
- end
28
- end
@@ -1,36 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "out_forward", stub: :daemon do
4
- let(:exists_user) { build(:user) }
5
- let(:match) { "test.out_forward.#{Time.now.to_i}.*" }
6
-
7
- before do
8
- login_with exists_user
9
- end
10
-
11
- it "Shown form" do
12
- visit daemon_setting_out_forward_path
13
- page.should have_css('input[name="setting[pattern]"]')
14
- end
15
-
16
- it "Appendable server setting", js: true do
17
- visit daemon_setting_out_forward_path
18
- all('.js-nested-column .js-append', visible: false).length.should == 1
19
- all('.js-append').first.click
20
- all('.js-nested-column .js-append', visible: false).length.should == 2
21
- end
22
-
23
- it "Updated config after submit", js: true do
24
- skip "Maybe validation failed"
25
- daemon.agent.config.should_not include(match)
26
- visit daemon_setting_out_forward_path
27
- within('form') do
28
- fill_in "Pattern", with: match
29
- fill_in "setting_server_0__host", with: "foobar"
30
- fill_in "setting_server_0__port", with: "9999"
31
- fill_in "Path", with: "/tmp/foo"
32
- end
33
- click_button I18n.t("fluentd.common.finish")
34
- daemon.agent.config.should include(match)
35
- end
36
- end
@@ -1,26 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "out_tdlog", stub: :daemon do
4
- let(:exists_user) { build(:user) }
5
- let(:api_key) { "dummydummy" }
6
-
7
- before do
8
- login_with exists_user
9
- end
10
-
11
- it "Shown form with filled in td.*.* on match" do
12
- visit daemon_setting_out_tdlog_path
13
- page.should have_css('input[name="setting[pattern]"]')
14
- end
15
-
16
- it "Updated config after submit" do
17
- skip "validation failed"
18
- daemon.agent.config.should_not include(api_key)
19
- visit daemon_setting_out_tdlog_path
20
- within('form') do
21
- fill_in "Apikey", with: api_key
22
- end
23
- click_button I18n.t("fluentd.common.finish")
24
- daemon.agent.config.should include(api_key)
25
- end
26
- end
@@ -1,79 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "sessions" do
4
- let(:exists_user) { build(:user) }
5
- let(:submit_label) { I18n.t("terms.sign_in") }
6
- let(:after_sign_in_location) { daemon_path }
7
-
8
- describe "sign in with default password" do
9
- before do
10
- login_with user
11
- end
12
-
13
- context "correct credentials" do
14
- let(:user) { exists_user }
15
- it "login success, then redirect to root_path, and redirect_to daemon_path from root_path" do
16
- current_path.should == after_sign_in_location
17
- end
18
- end
19
-
20
- context "wrong credentials" do
21
- let(:user) { build(:user, password: "passw0rd") }
22
-
23
- it "current location is not root_path" do
24
- current_path.should_not == after_sign_in_location
25
- end
26
-
27
- it "display form for retry" do
28
- page.body.should have_css('form')
29
- end
30
- end
31
- end
32
-
33
- describe "sign in with modified password" do
34
- let(:user) { build(:user, password: password) }
35
- let(:new_password) { "newpassword" }
36
- let(:old_password) { Settings.default_password }
37
-
38
- before do
39
- exists_user.update_attributes(current_password: Settings.default_password, password: new_password, password_confirmation: new_password)
40
-
41
- login_with user
42
- end
43
-
44
- after do
45
- # reset password to the default
46
- FileUtils.rm_f(User::ENCRYPTED_PASSWORD_FILE)
47
- end
48
-
49
- context "correct password" do
50
- let(:password) { new_password }
51
- it "login success" do
52
- current_path.should == after_sign_in_location
53
- end
54
- end
55
-
56
- context "wrong password" do
57
- let(:password) { old_password }
58
- it "login failed" do
59
- current_path.should_not == after_sign_in_location
60
- end
61
- end
62
- end
63
-
64
- describe "sign out process" do
65
- let(:submit_label) { I18n.t("terms.sign_in") }
66
- before do
67
- login_with exists_user
68
- end
69
-
70
- before do
71
- visit root_path
72
- click_link I18n.t("terms.sign_out")
73
- end
74
-
75
- it "at sign in page after sign out" do
76
- current_path.should == new_sessions_path
77
- end
78
- end
79
- end
@@ -1,95 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'setting', stub: :daemon do
4
- let!(:exists_user) { build(:user) }
5
- include_context 'daemon has some config histories'
6
- include_context 'daemon had been started once'
7
-
8
- before do
9
- login_with exists_user
10
-
11
- daemon.agent.config_write 'GREAT CONFIG HERE'
12
-
13
- visit '/daemon/setting'
14
- end
15
-
16
- it 'shows setting' do
17
- page.should have_css('h1', text: I18n.t('fluentd.settings.show.page_title'))
18
- page.should have_link(I18n.t('terms.edit'))
19
- page.should have_css('pre', text: 'GREAT CONFIG HERE')
20
- expect(all('.row tr').count).to eq Settings.histories_count_in_preview + 1 # links to hisotries#show + 1 table header
21
- page.should have_link(I18n.t('fluentd.settings.show.link_to_histories'))
22
- page.should have_text(I18n.t('fluentd.settings.running_backup.title'))
23
- end
24
-
25
- it 'will go to histories#index' do
26
- click_link I18n.t('fluentd.settings.show.link_to_histories')
27
-
28
- page.should have_css('h1', text: I18n.t('fluentd.settings.histories.index.page_title'))
29
- end
30
-
31
- it 'will go to histories#show' do
32
- all('.row tr td a').first.click
33
-
34
- page.should have_css('h1', text: I18n.t('fluentd.settings.histories.show.page_title'))
35
- end
36
-
37
- it 'edits setting' do
38
- click_link I18n.t('terms.edit')
39
-
40
- page.should have_css('h1', text: I18n.t('fluentd.settings.edit.page_title'))
41
- page.should have_css('p.text-danger', text: I18n.t('terms.notice_restart_for_config_edit', brand: 'fluentd'))
42
-
43
- fill_in 'config', with: 'YET ANOTHER CONFIG'
44
-
45
- click_button I18n.t('terms.update')
46
-
47
- current_path.should == '/daemon/setting'
48
- page.should have_css('pre', text: 'YET ANOTHER CONFIG')
49
- end
50
-
51
- describe "config" do
52
- before do
53
- Fluentd::Agent::TdAgent.any_instance.stub(:dryrun).with(an_instance_of(String)).and_return(true)
54
- daemon.agent.config_write conf
55
- click_link I18n.t('terms.edit')
56
- end
57
-
58
- context "plain config" do
59
- let(:conf) { <<-'CONF' }
60
- <source>
61
- type forward
62
- </source>
63
- CONF
64
-
65
- it 'configtest' do
66
- click_button I18n.t('terms.configtest')
67
- page.should have_css('.alert-success')
68
- end
69
-
70
- it "update & restart check" do
71
- click_button I18n.t('terms.update')
72
- daemon.agent.config.gsub("\r\n", "\n").should == conf # CodeMirror exchange \n -> \r\n
73
- end
74
- end
75
-
76
- context "embedded config" do
77
- let(:conf) { <<-'CONF' }
78
- <source>
79
- type forward
80
- id "foo#{Time.now.to_s}"
81
- </source>
82
- CONF
83
-
84
- it 'configtest' do
85
- click_button I18n.t('terms.configtest')
86
- page.should have_css('.alert-success')
87
- end
88
-
89
- it "update & restart check" do
90
- click_button I18n.t('terms.update')
91
- daemon.agent.config.gsub("\r\n", "\n").should == conf # CodeMirror exchange \n -> \r\n
92
- end
93
- end
94
- end
95
- end