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
@@ -76,6 +76,7 @@ en:
76
76
  authors: Authors
77
77
  summary: Summary
78
78
  category: Category
79
+ api_version: API version
79
80
  installed_version: Installed Version
80
81
  latest_version: Latest Version
81
82
  install_specific_version: Install this version
@@ -76,6 +76,7 @@ ja:
76
76
  authors: 作者
77
77
  summary: 概要
78
78
  category: カテゴリ
79
+ api_version: APIバージョン
79
80
  installed_version: インストール済みバージョン
80
81
  latest_version: 最新バージョン
81
82
  install_specific_version: このバージョンをインストール
@@ -4,7 +4,7 @@ group :development, :test do
4
4
  gem "rake"
5
5
  gem "pry"
6
6
  gem "pry-rails"
7
- gem "rspec-rails", "~> 3.0"
7
+ gem "test-unit-rails"
8
8
  end
9
9
 
10
10
  group :development do
@@ -19,6 +19,7 @@ group :test do
19
19
  gem "factory_bot_rails"
20
20
  gem "capybara", "~> 3.1.1"
21
21
  gem "capybara-screenshot"
22
+ gem "chromedriver-helper"
22
23
  gem "simplecov", "~> 0.16.1", require: false
23
24
  gem "webmock", "~> 3.3.0"
24
25
  gem "timecop"
@@ -1,3 +1,3 @@
1
1
  module FluentdUI
2
- VERSION = "1.0.0.beta.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,8 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ # For debugging JavaScript, make slower tests...
5
+ # caps = Selenium::WebDriver::Remote::Capabilities.chrome(loggingPrefs: { browser: 'ALL' })
6
+ # Add `options: { desired_capabilities: caps }` and then paste `pp page.driver.browser.manage.logs.get(:browser)`
7
+ driven_by :selenium, using: :headless_chrome, screen_size: [1920, 1080]
8
+ end
@@ -0,0 +1,42 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationControllerTest < ActionDispatch::IntegrationTest
4
+ setup do
5
+ user = FactoryBot.build(:user)
6
+ post(sessions_path(session: { name: user.name, password: user.password }))
7
+
8
+ I18n.locale = I18n.default_locale # initialize
9
+ end
10
+
11
+ sub_test_case "with params[:lang]" do
12
+ data("available locale" => [:ja, :ja],
13
+ "unavailable locale" => [:ka, :en])
14
+ test "locales" do |(locale, expected_locale)|
15
+ get(daemon_path, params: { lang: locale })
16
+ assert_equal(expected_locale, I18n.locale)
17
+ end
18
+ end
19
+
20
+ sub_test_case "with session[:prefer_lang]" do
21
+ setup do
22
+ any_instance_of(ApplicationController) do |object|
23
+ stub(object).locale_from_session { :ja }
24
+ end
25
+ end
26
+
27
+ test "session[:prefer_lang] will be set as locale" do
28
+ get(daemon_path)
29
+ assert_equal(:ja, I18n.locale)
30
+ end
31
+ end
32
+
33
+ sub_test_case "with request.env['HTTP_ACCEPT_LANGUAGE']" do
34
+ data("available" =>["ja", :ja],
35
+ "not available but start with en" => ["en-us", :en],
36
+ "accept_language is invalid" => ["ka", :en])
37
+ test "accept_language" do |(accept_language, expected_locale)|
38
+ get(daemon_path, env: { "HTTP_ACCEPT_LANGUAGE" => accept_language })
39
+ assert_equal(expected_locale, I18n.locale)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,39 @@
1
+ require "test_helper"
2
+
3
+ class Fluentd
4
+ class AgentsControllerTest < ActionDispatch::IntegrationTest
5
+ setup do
6
+ @log = Object.new
7
+ @agent = Object.new
8
+ @fluentd = FactoryBot.build(:fluentd)
9
+ stub(@agent).log { @log }
10
+ stub(@fluentd).agent { @agent }
11
+ stub(Fluentd).instance { @fluentd }
12
+
13
+
14
+ user = FactoryBot.build(:user)
15
+ post(sessions_path(session: { name: user.name, password: user.password }))
16
+
17
+
18
+ end
19
+
20
+ data("stop" => "stop",
21
+ "start" => "start",
22
+ "restart" => "restart",
23
+ "reload" => "reload")
24
+ test "the action succeed" do |action|
25
+ mock(@agent).__send__(action) { true }
26
+ put(__send__("#{action}_daemon_agent_path"))
27
+ end
28
+
29
+ data("stop" => "stop",
30
+ "start" => "start",
31
+ "restart" => "restart",
32
+ "reload" => "reload")
33
+ test "the action failure" do |action|
34
+ mock(@agent).__send__(action) { false }
35
+ mock(@log).tail(1) { ["dummylog"] } unless action == "stop"
36
+ put(__send__("#{action}_daemon_agent_path"))
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,70 @@
1
+ require "test_helper"
2
+
3
+ class MiscControllerTest < ActionDispatch::IntegrationTest
4
+ class DummyAgent
5
+ def log
6
+ Struct.new(:read).new(read: "dummy_log_content")
7
+ end
8
+
9
+ def version
10
+ "dummy version"
11
+ end
12
+ end
13
+
14
+ setup do
15
+ @fluentd = FactoryBot.build(:fluentd, log_file: "dummy.log")
16
+ @agent = DummyAgent.new
17
+ @fluentd_log_content = @agent.log.read
18
+ @fluentd_version = @agent.version
19
+ @fluentd_ui_log_content = <<-LOG.strip_heredoc
20
+ log1
21
+ log2
22
+ log3
23
+ LOG
24
+
25
+ @dummy_log_path = "tmp/dummy.log"
26
+ @destination_dir = Rails.root.join("tmp/system_info")
27
+
28
+ user = FactoryBot.build(:user)
29
+ post(sessions_path(session: { name: user.name, password: user.password }))
30
+ any_instance_of(MiscController) do |object|
31
+ stub(object).log_path { @dummy_log_path }
32
+ end
33
+
34
+ File.write(@dummy_log_path, @fluentd_ui_log_content)
35
+ stub(@fluentd).agent { @agent }
36
+ stub(Fluentd).instance { @fluentd }
37
+ end
38
+
39
+ sub_test_case "download info" do
40
+ setup do
41
+ get(misc_download_info_path)
42
+ #expand files in zip
43
+ Zip::File.open(Rails.root.join("tmp/system_info.zip")) do |zip_file|
44
+ FileUtils.mkdir_p(@destination_dir)
45
+
46
+ zip_file.each do |entry|
47
+ destination = File.join(@destination_dir, entry.name)
48
+ zip_file.extract(entry, destination) unless File.exist?(destination)
49
+ end
50
+ end
51
+ end
52
+
53
+ teardown do
54
+ FileUtils.rm_rf(Rails.root.join("tmp/system_info.zip"))
55
+ FileUtils.rm_rf(@destination_dir)
56
+ FileUtils.rm_rf("tmp/dummy.log")
57
+ end
58
+
59
+ def content_of(name)
60
+ File.read(File.join(@destination_dir, name))
61
+ end
62
+
63
+ test "write files" do
64
+ assert_equal("#{@fluentd_log_content}\n", content_of("fluentd.log"))
65
+ assert_equal("#{@fluentd_ui_log_content}", content_of("fluentd-ui.log"))
66
+ assert_match("RAILS_ENV=test", content_of("env.txt"))
67
+ assert_match("fluentd: #{@fluentd_version}", content_of("versions.txt"))
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,29 @@
1
+ require "test_helper"
2
+
3
+ class PollingControllerTest < ActionDispatch::IntegrationTest
4
+ setup do
5
+ user = FactoryBot.build(:user)
6
+ post(sessions_path(session: { name: user.name, password: user.password }))
7
+ end
8
+
9
+ test "may find nothing" do
10
+ stub(Plugin).installing { [] }
11
+ stub(Plugin).uninstalling { [] }
12
+ get(polling_alerts_path)
13
+ assert_response(:success)
14
+ end
15
+
16
+ test "may find gems being uninstalled" do
17
+ stub(Plugin).installing { [] }
18
+ stub(Plugin).uninstalling { [FactoryBot.build(:plugin)] }
19
+ get(polling_alerts_path)
20
+ assert_response(:success)
21
+ end
22
+
23
+ test "may find gems being installed" do
24
+ stub(Plugin).installing { [FactoryBot.build(:plugin)] }
25
+ stub(Plugin).uninstalling { [] }
26
+ get(polling_alerts_path)
27
+ assert_response(:success)
28
+ end
29
+ end
@@ -0,0 +1,26 @@
1
+ require "test_helper"
2
+
3
+ class PluginDecoratorTest < ActiveSupport::TestCase
4
+ setup do
5
+ @plugin = FactoryBot.build(:plugin).decorate
6
+ end
7
+
8
+ sub_test_case "#status" do
9
+ test "returns the term for processing while processing" do
10
+ mock(@plugin.object).processing? { true }
11
+ assert_equal(I18n.t("terms.processing"), @plugin.status)
12
+ end
13
+
14
+ test "already installed" do
15
+ stub(@plugin.object).processing? { false }
16
+ stub(@plugin.object).installed? { true }
17
+ assert_equal(I18n.t("terms.installed"), @plugin.status)
18
+ end
19
+
20
+ test "not installed yet" do
21
+ stub(@plugin.object).processing? { false }
22
+ stub(@plugin.object).installed? { false }
23
+ assert_equal(I18n.t("terms.not_installed"), @plugin.status)
24
+ end
25
+ end
26
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,57 @@
1
+ require "test_helper"
2
+
3
+ class DashboardTest < ActionDispatch::IntegrationTest
4
+ setup do
5
+ login_with(FactoryBot.build(:user))
6
+ end
7
+
8
+ test "no configuration" do
9
+ visit("/")
10
+ within("h1") do
11
+ assert_equal("fluentd", text)
12
+ end
13
+ assert do
14
+ find_link(I18n.t('terms.setup', target: 'fluentd'))
15
+ end
16
+ assert do
17
+ find_link(I18n.t('terms.setup', target: 'td-agent'))
18
+ end
19
+ assert do
20
+ !page.has_css?(".fluentd-status")
21
+ end
22
+ end
23
+
24
+ test "fluentd is stop" do
25
+ stub_daemon(running: false)
26
+ visit("/")
27
+ assert do
28
+ page.has_css?('h1', text: I18n.t('fluentd.show.page_title'))
29
+ end
30
+ assert do
31
+ page.has_css?('h4', text: I18n.t('fluentd.common.stopped'))
32
+ end
33
+ assert do
34
+ page.has_css?('h4', text: I18n.t('fluentd.common.fluentd_info'))
35
+ end
36
+ assert do
37
+ page.has_css?(".fluentd-status .stopped")
38
+ end
39
+ end
40
+
41
+ test "fluentd is running" do
42
+ stub_daemon(running: true)
43
+ visit("/")
44
+ assert do
45
+ page.has_css?('h1', text: I18n.t('fluentd.show.page_title'))
46
+ end
47
+ assert do
48
+ page.has_css?('h4', text: I18n.t('fluentd.common.running'))
49
+ end
50
+ assert do
51
+ page.has_css?('h4', text: I18n.t('fluentd.common.fluentd_info'))
52
+ end
53
+ assert do
54
+ page.has_css?(".fluentd-status .running")
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,139 @@
1
+ require "test_helper"
2
+
3
+ class HistoriesTest < ActionDispatch::IntegrationTest
4
+ include ConfigHistories::DaemonHaveSomeConfigHistories
5
+
6
+ setup do
7
+ login_with(FactoryBot.build(:user))
8
+ end
9
+
10
+ sub_test_case "index" do
11
+ setup do
12
+ visit("/daemon/setting/histories")
13
+ end
14
+
15
+ test "show histories#index" do
16
+ assert do
17
+ page.has_css?("h1", text: I18n.t("fluentd.settings.histories.index.page_title"))
18
+ end
19
+ # links to hisotries#show + 1 table header
20
+ assert_equal(10, all(".row tr").count)
21
+ end
22
+
23
+ test "go to histories#show" do
24
+ all(".row tr td a").first.click
25
+
26
+ assert do
27
+ page.has_css?("h1", text: I18n.t("fluentd.settings.histories.show.page_title"))
28
+ end
29
+ end
30
+ end
31
+
32
+ sub_test_case "show" do
33
+ setup do
34
+ @last_backup_file = Fluentd::SettingArchive::BackupFile.new(daemon.agent.backup_files_in_new_order.first)
35
+ @new_file = Fluentd::SettingArchive::BackupFile.new(daemon.agent.backup_files_in_new_order[1])
36
+ end
37
+
38
+ sub_test_case "with diff" do
39
+ setup do
40
+ visit("/daemon/setting/histories/#{@last_backup_file.file_id}")
41
+ end
42
+
43
+ test "show histories#show" do
44
+ assert do
45
+ page.has_css?("h1", text: I18n.t("fluentd.settings.histories.show.page_title"))
46
+ end
47
+ doc = Nokogiri.HTML(page.source)
48
+ assert_equal(@last_backup_file.content.strip, doc.search("pre").first.text)
49
+ end
50
+
51
+ test "shows diff between current and target" do
52
+ within(".diff pre") do
53
+ [
54
+ "- @type http",
55
+ "+ @type forward",
56
+ "- port 8899",
57
+ "+ port 24224"
58
+ ].each do |text|
59
+ assert do
60
+ has_text?(text)
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ test "update config and redirect to setting#show" do
67
+ click_link(I18n.t("terms.reuse"))
68
+
69
+ assert do
70
+ page.has_css?("h1", text: I18n.t("fluentd.settings.show.page_title"))
71
+ end
72
+ assert do
73
+ page.has_text?(I18n.t("messages.config_successfully_copied", brand: "fluentd") )
74
+ end
75
+ assert_equal("/daemon/setting", page.current_path)
76
+ end
77
+ end
78
+
79
+ sub_test_case "without diff" do
80
+ setup do
81
+ visit("/daemon/setting/histories/#{@new_file.file_id}")
82
+ end
83
+
84
+ test "shows no diff message" do
85
+ assert do
86
+ page.has_text?(I18n.t("messages.no_diff"))
87
+ end
88
+ end
89
+ end
90
+
91
+ sub_test_case "configtest" do
92
+ setup do
93
+ # To use fluentd_gem for real dry-run checking
94
+ @daemon = FactoryBot.build(:fluentd, variant: "fluentd_gem")
95
+ end
96
+
97
+ def config_test(config)
98
+ daemon.agent.config_write config
99
+ daemon.agent.config_write "# dummy"
100
+ backup = Fluentd::SettingArchive::BackupFile.new(daemon.agent.backup_files_in_new_order.first)
101
+ visit("/daemon/setting/histories/#{backup.file_id}")
102
+ click_link(I18n.t("terms.configtest"))
103
+ end
104
+
105
+ test "invalid config" do
106
+ config_test(<<-CONFIG)
107
+ <source>
108
+ @type no_such_plugin
109
+ </source>
110
+ CONFIG
111
+ assert do
112
+ !page.has_css?('.alert-success')
113
+ end
114
+ assert do
115
+ page.has_css?('.alert-danger')
116
+ end
117
+ assert do
118
+ page.has_text?(%Q|Unknown input plugin 'no_such_plugin'|)
119
+ end
120
+ end
121
+
122
+ test "valid config" do
123
+ config_test(<<-CONFIG)
124
+ <source>
125
+ @type syslog
126
+ tag syslog
127
+ </source>
128
+ CONFIG
129
+
130
+ assert do
131
+ page.has_css?('.alert-success')
132
+ end
133
+ assert do
134
+ !page.has_css?('.alert-danger')
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end