mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 19:06:12 +02:00
Add test/system/fluentd/setting/*_test.rb
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
parent
90e6df54f3
commit
a2f0a29b54
26
test/support/configurable_daemon_settings.rb
Normal file
26
test/support/configurable_daemon_settings.rb
Normal file
@ -0,0 +1,26 @@
|
||||
module ConfigurableDaemonSettings
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
test "show form" do
|
||||
visit(__send__("daemon_setting_#{@type}_path"))
|
||||
assert do
|
||||
page.has_css?("input[name=\"setting[#{@form_name}]\"]")
|
||||
end
|
||||
end
|
||||
|
||||
test "Update config" do
|
||||
assert do
|
||||
!@daemon.agent.config.include?(@form_value)
|
||||
end
|
||||
visit(__send__("daemon_setting_#{@type}_path"))
|
||||
within("form") do
|
||||
fill_in(@form_name.capitalize, with: @form_value)
|
||||
end
|
||||
click_button(I18n.t("fluentd.common.finish"))
|
||||
assert do
|
||||
@daemon.agent.config.include?(@form_value)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
13
test/system/fluentd/setting/in_forward_test.rb
Normal file
13
test/system/fluentd/setting/in_forward_test.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class InForwardTest < ApplicationSystemTestCase
|
||||
include ConfigurableDaemonSettings
|
||||
|
||||
setup do
|
||||
login_with(FactoryBot.build(:user))
|
||||
@type = "in_forward"
|
||||
@form_name = "port"
|
||||
@form_value = "12345"
|
||||
@daemon = stub_daemon
|
||||
end
|
||||
end
|
||||
13
test/system/fluentd/setting/in_http_test.rb
Normal file
13
test/system/fluentd/setting/in_http_test.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class InHttpTest < ApplicationSystemTestCase
|
||||
include ConfigurableDaemonSettings
|
||||
|
||||
setup do
|
||||
login_with(FactoryBot.build(:user))
|
||||
@type = "in_http"
|
||||
@form_name = "port"
|
||||
@form_value = "12345"
|
||||
@daemon = stub_daemon
|
||||
end
|
||||
end
|
||||
13
test/system/fluentd/setting/in_monitor_agent.rb
Normal file
13
test/system/fluentd/setting/in_monitor_agent.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class InMonitorAgentTest < ApplicationSystemTestCase
|
||||
include ConfigurableDaemonSettings
|
||||
|
||||
setup do
|
||||
login_with(FactoryBot.build(:user))
|
||||
@type = "in_monitor_agent"
|
||||
@form_name = "port"
|
||||
@form_value = "12345"
|
||||
@daemon = stub_daemon
|
||||
end
|
||||
end
|
||||
32
test/system/fluentd/setting/out_elasticsearch_test.rb
Normal file
32
test/system/fluentd/setting/out_elasticsearch_test.rb
Normal file
@ -0,0 +1,32 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class OutElasticsearchTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
login_with(FactoryBot.build(:user))
|
||||
@daemon = stub_daemon
|
||||
@pattern = "test.out_forward.#{Time.now.to_i}.*"
|
||||
end
|
||||
|
||||
test "show form" do
|
||||
visit(daemon_setting_out_elasticsearch_path)
|
||||
assert do
|
||||
page.has_css?('input[name="setting[pattern]"]')
|
||||
end
|
||||
end
|
||||
|
||||
test "Update config" do
|
||||
assert do
|
||||
!@daemon.agent.config.include?(@pattern)
|
||||
end
|
||||
visit(daemon_setting_out_elasticsearch_path)
|
||||
within("form") do
|
||||
fill_in("Pattern", with: @pattern)
|
||||
fill_in("Index name", with: "index")
|
||||
fill_in("Type name", with: "type_name")
|
||||
end
|
||||
click_button(I18n.t("fluentd.common.finish"))
|
||||
assert do
|
||||
@daemon.agent.config.include?(@pattern)
|
||||
end
|
||||
end
|
||||
end
|
||||
41
test/system/fluentd/setting/out_forward_test.rb
Normal file
41
test/system/fluentd/setting/out_forward_test.rb
Normal file
@ -0,0 +1,41 @@
|
||||
require "application_system_test_case"
|
||||
require "fluent/plugin/buf_file"
|
||||
|
||||
class OutForwardTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
login_with(FactoryBot.build(:user))
|
||||
@daemon = stub_daemon
|
||||
@pattern = "test.out_forward.#{Time.now.to_i}.*"
|
||||
end
|
||||
|
||||
test "show form" do
|
||||
visit(daemon_setting_out_forward_path)
|
||||
assert do
|
||||
page.has_css?('input[name="setting[pattern]"]')
|
||||
end
|
||||
end
|
||||
|
||||
test "appendable server setting" do
|
||||
visit(daemon_setting_out_forward_path)
|
||||
assert_equal(1, all(".js-nested-column .js-append", visible: false).size)
|
||||
all('.js-append').first.click
|
||||
assert_equal(2, all(".js-nested-column .js-append", visible: false).size)
|
||||
end
|
||||
|
||||
test "update config" do
|
||||
assert do
|
||||
!@daemon.agent.config.include?(@pattern)
|
||||
end
|
||||
visit(daemon_setting_out_forward_path)
|
||||
within("form") do
|
||||
fill_in("Pattern", with: @pattern)
|
||||
fill_in("setting_server_0__host", with: "localhost")
|
||||
fill_in("setting_server_0__port", with: "9999")
|
||||
fill_in("Path", with: "/tmp/foo")
|
||||
end
|
||||
click_button(I18n.t("fluentd.common.finish"))
|
||||
assert do
|
||||
@daemon.agent.config.include?(@pattern)
|
||||
end
|
||||
end
|
||||
end
|
||||
15
test/system/fluentd/setting/out_stdout_test.rb
Normal file
15
test/system/fluentd/setting/out_stdout_test.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
require "fluent/plugin/buf_file"
|
||||
|
||||
class OutStdoutTest < ApplicationSystemTestCase
|
||||
include ConfigurableDaemonSettings
|
||||
|
||||
setup do
|
||||
login_with(FactoryBot.build(:user))
|
||||
@type = "out_stdout"
|
||||
@form_name = "pattern"
|
||||
@form_value = "stdout.**"
|
||||
@daemon = stub_daemon
|
||||
end
|
||||
end
|
||||
15
test/system/fluentd/setting/out_tdlog_test.rb
Normal file
15
test/system/fluentd/setting/out_tdlog_test.rb
Normal file
@ -0,0 +1,15 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
require "fluent/plugin/buf_file"
|
||||
|
||||
class OutTdlogTest < ApplicationSystemTestCase
|
||||
include ConfigurableDaemonSettings
|
||||
|
||||
setup do
|
||||
login_with(FactoryBot.build(:user))
|
||||
@type = "out_tdlog"
|
||||
@form_name = "apikey"
|
||||
@form_value = "dummydummy"
|
||||
@daemon = stub_daemon
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user