fluentd-ui 0.3.11 → 0.3.12

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 (53) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +11 -0
  3. data/Gemfile.lock +1 -1
  4. data/app/assets/stylesheets/common.css.scss +4 -0
  5. data/app/controllers/application_controller.rb +25 -15
  6. data/app/controllers/concerns/setting_history_concern.rb +28 -0
  7. data/app/controllers/fluentd/agents_controller.rb +13 -15
  8. data/app/controllers/fluentd/settings/histories_controller.rb +3 -13
  9. data/app/controllers/fluentd/settings/notes_controller.rb +16 -0
  10. data/app/controllers/fluentd/settings/running_backup_controller.rb +2 -12
  11. data/app/controllers/fluentd/settings_controller.rb +2 -2
  12. data/app/controllers/misc_controller.rb +27 -18
  13. data/app/controllers/polling_controller.rb +10 -13
  14. data/app/helpers/settings_helper.rb +67 -29
  15. data/app/models/{fluentd/setting/backup_file.rb → concerns/fluentd/setting_archive/archivable.rb} +11 -11
  16. data/app/models/fluent_gem.rb +1 -1
  17. data/app/models/fluentd/agent/fluentd_gem.rb +7 -3
  18. data/app/models/fluentd/agent/local_common.rb +44 -9
  19. data/app/models/fluentd/agent/td_agent/macosx.rb +5 -2
  20. data/app/models/fluentd/agent/td_agent/unix.rb +4 -0
  21. data/app/models/fluentd/setting/out_s3.rb +3 -3
  22. data/app/models/fluentd/setting_archive/backup_file.rb +20 -0
  23. data/app/models/fluentd/setting_archive/note.rb +28 -0
  24. data/app/models/plugin.rb +12 -6
  25. data/app/views/fluentd/settings/histories/_list.html.haml +17 -6
  26. data/app/views/fluentd/settings/histories/show.html.haml +12 -2
  27. data/app/views/fluentd/settings/running_backup/show.html.haml +8 -3
  28. data/app/views/layouts/application.html.erb +1 -1
  29. data/app/views/plugins/updated.html.haml +21 -19
  30. data/app/views/shared/_flash.html.haml +3 -0
  31. data/config/locales/translation_en.yml +5 -0
  32. data/config/locales/translation_ja.yml +5 -0
  33. data/config/routes.rb +4 -0
  34. data/lib/file_reverse_reader.rb +38 -13
  35. data/lib/fluentd-ui/version.rb +1 -1
  36. data/spec/controllers/application_controller_spec.rb +88 -0
  37. data/spec/controllers/fluentd/agents_controller_spec.rb +45 -0
  38. data/spec/controllers/misc_controller_spec.rb +68 -0
  39. data/spec/controllers/polling_controller_spec.rb +34 -0
  40. data/spec/features/fluentd/setting/histories_spec.rb +87 -0
  41. data/spec/features/fluentd/setting/notes_spec.rb +27 -0
  42. data/spec/features/fluentd/setting/out_forward_spec.rb +40 -0
  43. data/spec/features/fluentd/setting/{ranning_backup_spec.rb → running_backup_spec.rb} +36 -0
  44. data/spec/features/setting_spec.rb +2 -2
  45. data/spec/models/fluentd/agent_spec.rb +49 -0
  46. data/spec/support/fixtures/error3.log +7 -0
  47. data/spec/support/fluentd_agent_common_behavior.rb +14 -0
  48. metadata +23 -13
  49. data/app/helpers/miscs_helper.rb +0 -2
  50. data/db/seeds.rb +0 -7
  51. data/spec/controllers/plugins_controller_spec.rb +0 -5
  52. data/spec/controllers/tutorials_controller_spec.rb +0 -5
  53. data/spec/features/fluentd/setting/hisotries_spec.rb +0 -48
@@ -0,0 +1,40 @@
1
+ require "spec_helper"
2
+
3
+ describe "out_forward", stub: :daemon do
4
+ before { login_with exists_user }
5
+
6
+ let(:type) { "out_forward" }
7
+ let(:page_url) { send("daemon_setting_#{type}_path") }
8
+ let(:form_values) { {
9
+ Match: "*",
10
+ Name: "name",
11
+ Host: "host",
12
+ Port: "9999",
13
+ Path: "/dev/null",
14
+ } }
15
+
16
+ it "Updated config after submit" do
17
+ daemon.agent.config.should_not include("type file") # out_forward's Secondary hidden field
18
+ form_values.each_pair do |k,v|
19
+ daemon.agent.config.should_not include(v)
20
+ end
21
+ visit page_url
22
+ within("#new_fluentd_setting_#{type}") do
23
+ form_values.each_pair do |k,v|
24
+ fill_in k, with: v
25
+ end
26
+ end
27
+ click_button I18n.t("fluentd.common.finish")
28
+ form_values.each_pair do |k,v|
29
+ daemon.agent.config.should include(v)
30
+ end
31
+ daemon.agent.config.should include("type file") # out_forward's Secondary hidden field
32
+ end
33
+
34
+ it "Click to append Server fields", js: true do
35
+ visit page_url
36
+ all(".js-multiple").length.should == 1
37
+ first(".js-multiple .js-append").click
38
+ all(".js-multiple").length.should == 2
39
+ end
40
+ end
@@ -43,6 +43,42 @@ describe "running_backup", stub: :daemon do
43
43
  page.should have_text(I18n.t('messages.config_successfully_copied', brand: 'fluentd') )
44
44
  page.should have_text(backup_content)
45
45
  end
46
+
47
+ describe "configtest" do
48
+ let(:backup_content){ config }
49
+ let(:daemon) { build(:fluentd, variant: "fluentd_gem") } # To use fluentd_gem for real dry-run checking
50
+ before do
51
+ click_link I18n.t("terms.configtest")
52
+ end
53
+
54
+ context "invalid configfile" do
55
+ let(:config) { <<-CONFIG }
56
+ <source>
57
+ type aaaaaaaaaaaa
58
+ </source>
59
+ CONFIG
60
+
61
+ it do
62
+ page.should_not have_css('.alert-success')
63
+ page.should have_css('.alert-danger')
64
+ page.should have_text(%Q|Unknown input plugin 'aaaaaaaaaaaa'|)
65
+ end
66
+ end
67
+
68
+ context "valid configfile" do
69
+ let(:config) { <<-CONFIG }
70
+ <source>
71
+ type syslog
72
+ tag syslog
73
+ </source>
74
+ CONFIG
75
+
76
+ it do
77
+ page.should have_css('.alert-success')
78
+ page.should_not have_css('.alert-danger')
79
+ end
80
+ end
81
+ end
46
82
  end
47
83
  end
48
84
  end
@@ -17,7 +17,7 @@ describe 'setting', stub: :daemon do
17
17
  page.should have_css('h1', text: I18n.t('fluentd.settings.show.page_title'))
18
18
  page.should have_link(I18n.t('terms.edit'))
19
19
  page.should have_css('pre', text: 'GREAT CONFIG HERE')
20
- expect(all('.row li').count).to eq Settings.histories_count_in_preview #links to hisotries#show
20
+ expect(all('.row tr').count).to eq Settings.histories_count_in_preview + 1 # links to hisotries#show + 1 table header
21
21
  page.should have_link(I18n.t('fluentd.settings.show.link_to_histories'))
22
22
  page.should have_text(I18n.t('fluentd.settings.running_backup.title'))
23
23
  end
@@ -29,7 +29,7 @@ describe 'setting', stub: :daemon do
29
29
  end
30
30
 
31
31
  it 'will go to histories#show' do
32
- all('.row li a').first.click
32
+ all('.row tr td a').first.click
33
33
 
34
34
  page.should have_css('h1', text: I18n.t('fluentd.settings.histories.show.page_title'))
35
35
  end
@@ -22,6 +22,7 @@ describe Fluentd::Agent do
22
22
  end
23
23
 
24
24
  describe "#start" do
25
+ before { instance.config_write "" } # ensure valid config
25
26
  before { instance.stub(:running?).and_return(running) }
26
27
 
27
28
  context "running" do
@@ -95,6 +96,29 @@ describe Fluentd::Agent do
95
96
  describe "#restart" do
96
97
  it_should_behave_like "Restart strategy"
97
98
  end
99
+
100
+ describe "#dryrun" do
101
+ subject { instance.dryrun }
102
+
103
+ describe "valid/invalid" do
104
+ before { instance.stub(:system).and_return(ret) }
105
+
106
+ context "valid config" do
107
+ let(:ret) { true }
108
+ it { should be_truthy }
109
+ end
110
+
111
+ context "invalid config" do
112
+ let(:ret) { false }
113
+ it { should be_falsy }
114
+ end
115
+ end
116
+
117
+ it "invoke #system" do
118
+ instance.should_receive(:system).with(/--dry-run/)
119
+ subject
120
+ end
121
+ end
98
122
  end
99
123
 
100
124
  describe "TdAgent" do
@@ -106,6 +130,7 @@ describe Fluentd::Agent do
106
130
  before do
107
131
  instance.stub(:detached_command).and_return(true)
108
132
  instance.stub(:pid_from_launchctl).and_return(true)
133
+ instance.config_write "" # ensure valid config
109
134
  end
110
135
 
111
136
  after do
@@ -128,6 +153,30 @@ describe Fluentd::Agent do
128
153
  expect(File.read(backup_file)).to eq File.read(instance.config_file)
129
154
  end
130
155
  end
156
+
157
+ describe "#dryrun" do
158
+ subject { instance.dryrun }
159
+
160
+ describe "valid/invalid" do
161
+ before { instance.stub(:detached_command).and_return(ret) }
162
+
163
+ context "valid config" do
164
+ let(:ret) { true }
165
+ it { should be_truthy }
166
+ end
167
+
168
+ context "invalid config" do
169
+ let(:ret) { false }
170
+ it { should be_falsy }
171
+ end
172
+ end
173
+
174
+ it "invoke #system" do
175
+ # --dry-run check on Mac, configtest for Unix
176
+ instance.should_receive(:detached_command).with(/(--dry-run|configtest)/)
177
+ subject
178
+ end
179
+ end
131
180
  end
132
181
  end
133
182
 
@@ -0,0 +1,7 @@
1
+ 2014-05-27 10:54:37 +0900 [info]: listening fluent socket on 0.0.0.0:24224
2
+ 2014-05-27 10:54:37 +0900 [error]: unexpected error error_class=Errno::EADDRINUSE error=#<Errno::EADDRINUSE: 1 Address already in use - bind(2) for "0.0.0.0" port 24224>
3
+ 2014-05-27 10:55:40 +0900 [error]: unexpected error error_class=Errno::EADDRINUSE error=#<Errno::EADDRINUSE: 2 Address already in use - bind(2) for "0.0.0.0" port 24224>
4
+ 2014-05-27 10:55:40 +0900 [error]: /Users/uu59/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cool.io-1.2.4/lib/cool.io/server.rb:57:in `initialize'
5
+ 2014-05-27 10:55:40 +0900 [error]: /Users/uu59/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cool.io-1.2.4/lib/cool.io/server.rb:57:in `new'
6
+ 2014-05-27 11:28:12 +0900 [error]: unexpected error error_class=Errno::EADDRINUSE error=#<Errno::EADDRINUSE: 3 Address already in use - bind(2) for "0.0.0.0" port 24224>
7
+ 2014-05-27 11:28:12 +0900 [error]: /Users/uu59/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/cool.io-1.2.4/lib/cool.io/server.rb:57:in `initialize'
@@ -108,6 +108,20 @@ shared_examples_for "Fluentd::Agent has common behavior" do |klass|
108
108
  one.should >= two
109
109
  end
110
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.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
111
125
  end
112
126
  end
113
127
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro Nakagawa
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-19 00:00:00.000000000 Z
12
+ date: 2015-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd
@@ -300,6 +300,7 @@ files:
300
300
  - app/controllers/application_controller.rb
301
301
  - app/controllers/concerns/.keep
302
302
  - app/controllers/concerns/setting_concern.rb
303
+ - app/controllers/concerns/setting_history_concern.rb
303
304
  - app/controllers/fluentd/agents_controller.rb
304
305
  - app/controllers/fluentd/settings/histories_controller.rb
305
306
  - app/controllers/fluentd/settings/in_forward_controller.rb
@@ -307,6 +308,7 @@ files:
307
308
  - app/controllers/fluentd/settings/in_monitor_agent_controller.rb
308
309
  - app/controllers/fluentd/settings/in_syslog_controller.rb
309
310
  - app/controllers/fluentd/settings/in_tail_controller.rb
311
+ - app/controllers/fluentd/settings/notes_controller.rb
310
312
  - app/controllers/fluentd/settings/out_elasticsearch_controller.rb
311
313
  - app/controllers/fluentd/settings/out_forward_controller.rb
312
314
  - app/controllers/fluentd/settings/out_mongo_controller.rb
@@ -326,11 +328,11 @@ files:
326
328
  - app/decorators/plugin_decorator.rb
327
329
  - app/helpers/application_helper.rb
328
330
  - app/helpers/fluentd/settings_helper.rb
329
- - app/helpers/miscs_helper.rb
330
331
  - app/helpers/settings_helper.rb
331
332
  - app/mailers/.keep
332
333
  - app/models/.keep
333
334
  - app/models/concerns/.keep
335
+ - app/models/concerns/fluentd/setting_archive/archivable.rb
334
336
  - app/models/fluent_gem.rb
335
337
  - app/models/fluentd.rb
336
338
  - app/models/fluentd/agent.rb
@@ -342,7 +344,6 @@ files:
342
344
  - app/models/fluentd/agent/td_agent/macosx.rb
343
345
  - app/models/fluentd/agent/td_agent/unix.rb
344
346
  - app/models/fluentd/setting.rb
345
- - app/models/fluentd/setting/backup_file.rb
346
347
  - app/models/fluentd/setting/common.rb
347
348
  - app/models/fluentd/setting/config.rb
348
349
  - app/models/fluentd/setting/in_forward.rb
@@ -356,6 +357,8 @@ files:
356
357
  - app/models/fluentd/setting/out_s3.rb
357
358
  - app/models/fluentd/setting/out_stdout.rb
358
359
  - app/models/fluentd/setting/out_td.rb
360
+ - app/models/fluentd/setting_archive/backup_file.rb
361
+ - app/models/fluentd/setting_archive/note.rb
359
362
  - app/models/plugin.rb
360
363
  - app/models/settings.rb
361
364
  - app/models/user.rb
@@ -450,7 +453,6 @@ files:
450
453
  - config/routes.rb
451
454
  - config/secrets.yml
452
455
  - db/schema.rb
453
- - db/seeds.rb
454
456
  - docs/screenshots/01.png
455
457
  - docs/screenshots/02.png
456
458
  - docs/screenshots/03.png
@@ -482,21 +484,24 @@ files:
482
484
  - public/fluentd.png
483
485
  - public/robots.txt
484
486
  - public/td-logo.png
485
- - spec/controllers/plugins_controller_spec.rb
487
+ - spec/controllers/application_controller_spec.rb
488
+ - spec/controllers/fluentd/agents_controller_spec.rb
489
+ - spec/controllers/misc_controller_spec.rb
486
490
  - spec/controllers/polling_controller_spec.rb
487
491
  - spec/controllers/sessions_controller_spec.rb
488
- - spec/controllers/tutorials_controller_spec.rb
489
492
  - spec/decorators/plugin_decorator_spec.rb
490
493
  - spec/factories/fluentd.rb
491
494
  - spec/factories/plugins.rb
492
495
  - spec/factories/user.rb
493
496
  - spec/features/dashboard_spec.rb
494
- - spec/features/fluentd/setting/hisotries_spec.rb
497
+ - spec/features/fluentd/setting/histories_spec.rb
495
498
  - spec/features/fluentd/setting/in_forward_spec.rb
496
499
  - spec/features/fluentd/setting/in_http_spec.rb
497
500
  - spec/features/fluentd/setting/in_monitor_agent_spec.rb
501
+ - spec/features/fluentd/setting/notes_spec.rb
502
+ - spec/features/fluentd/setting/out_forward_spec.rb
498
503
  - spec/features/fluentd/setting/out_stdout_spec.rb
499
- - spec/features/fluentd/setting/ranning_backup_spec.rb
504
+ - spec/features/fluentd/setting/running_backup_spec.rb
500
505
  - spec/features/fluentd_status_spec.rb
501
506
  - spec/features/fluentd_ui_update_available_spec.rb
502
507
  - spec/features/out_elasticsearch_spec.rb
@@ -525,6 +530,7 @@ files:
525
530
  - spec/support/config_histories.rb
526
531
  - spec/support/fixtures/error0.log
527
532
  - spec/support/fixtures/error2.log
533
+ - spec/support/fixtures/error3.log
528
534
  - spec/support/fluentd_agent_common_behavior.rb
529
535
  - spec/support/fluentd_agent_restart_strategy.rb
530
536
  - spec/support/javascript_macro.rb
@@ -697,21 +703,24 @@ signing_key:
697
703
  specification_version: 4
698
704
  summary: Web UI for Fluentd
699
705
  test_files:
700
- - spec/controllers/plugins_controller_spec.rb
706
+ - spec/controllers/application_controller_spec.rb
707
+ - spec/controllers/fluentd/agents_controller_spec.rb
708
+ - spec/controllers/misc_controller_spec.rb
701
709
  - spec/controllers/polling_controller_spec.rb
702
710
  - spec/controllers/sessions_controller_spec.rb
703
- - spec/controllers/tutorials_controller_spec.rb
704
711
  - spec/decorators/plugin_decorator_spec.rb
705
712
  - spec/factories/fluentd.rb
706
713
  - spec/factories/plugins.rb
707
714
  - spec/factories/user.rb
708
715
  - spec/features/dashboard_spec.rb
709
- - spec/features/fluentd/setting/hisotries_spec.rb
716
+ - spec/features/fluentd/setting/histories_spec.rb
710
717
  - spec/features/fluentd/setting/in_forward_spec.rb
711
718
  - spec/features/fluentd/setting/in_http_spec.rb
712
719
  - spec/features/fluentd/setting/in_monitor_agent_spec.rb
720
+ - spec/features/fluentd/setting/notes_spec.rb
721
+ - spec/features/fluentd/setting/out_forward_spec.rb
713
722
  - spec/features/fluentd/setting/out_stdout_spec.rb
714
- - spec/features/fluentd/setting/ranning_backup_spec.rb
723
+ - spec/features/fluentd/setting/running_backup_spec.rb
715
724
  - spec/features/fluentd_status_spec.rb
716
725
  - spec/features/fluentd_ui_update_available_spec.rb
717
726
  - spec/features/out_elasticsearch_spec.rb
@@ -740,6 +749,7 @@ test_files:
740
749
  - spec/support/config_histories.rb
741
750
  - spec/support/fixtures/error0.log
742
751
  - spec/support/fixtures/error2.log
752
+ - spec/support/fixtures/error3.log
743
753
  - spec/support/fluentd_agent_common_behavior.rb
744
754
  - spec/support/fluentd_agent_restart_strategy.rb
745
755
  - spec/support/javascript_macro.rb
@@ -1,2 +0,0 @@
1
- module MiscsHelper
2
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
- # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -1,5 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe PluginsController do
4
-
5
- end
@@ -1,5 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe TutorialsController, :type => :controller do
4
-
5
- end
@@ -1,48 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "histories", 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
- describe 'index' do
12
- before do
13
- visit '/daemon/setting/histories'
14
- end
15
-
16
- it 'show histories#index' do
17
- page.should have_css('h1', text: I18n.t('fluentd.settings.histories.index.page_title'))
18
- expect(all('.row li').count).to eq 9 #links to hisotries#show
19
- end
20
-
21
- it 'will go to histories#show' do
22
- all('.row li a').first.click
23
-
24
- page.should have_css('h1', text: I18n.t('fluentd.settings.histories.show.page_title'))
25
- end
26
- end
27
-
28
- describe 'show' do
29
- let(:last_backup_file) { Fluentd::Setting::BackupFile.new(daemon.agent.backup_files_in_new_order.first) }
30
-
31
- before do
32
- visit "/daemon/setting/histories/#{last_backup_file.file_id}"
33
- end
34
-
35
- it 'show histories#show' do
36
- page.should have_css('h1', text: I18n.t('fluentd.settings.histories.show.page_title'))
37
- page.should have_text(last_backup_file.content)
38
- end
39
-
40
- it 'update config and redirect to setting#show' do
41
- click_link I18n.t("terms.reuse")
42
-
43
- page.should have_css('h1', text: I18n.t('fluentd.settings.show.page_title'))
44
- page.should have_text(I18n.t('messages.config_successfully_copied', brand: 'fluentd') )
45
- page.should have_text(last_backup_file.content)
46
- end
47
- end
48
- end