mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 09:17:05 +02:00
Fix out_td setting type name
This commit is contained in:
parent
a6d11053d4
commit
edafcf3bb5
@ -116,7 +116,7 @@ class Fluentd
|
|||||||
def plugin_type_name
|
def plugin_type_name
|
||||||
# Fluentd::Setting::OutS3 -> s3
|
# Fluentd::Setting::OutS3 -> s3
|
||||||
# Override this method if not above style
|
# Override this method if not above style
|
||||||
self.class.to_s.split("::").last.sub(/(In|Out)/, "").downcase
|
try(:plugin_name) || self.class.to_s.split("::").last.sub(/(In|Out)/, "").downcase
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_if_present(key)
|
def print_if_present(key)
|
||||||
|
35
spec/models/fluentd/setting/in_syslog_spec.rb
Normal file
35
spec/models/fluentd/setting/in_syslog_spec.rb
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Fluentd::Setting::InSyslog do
|
||||||
|
let(:klass) { described_class }
|
||||||
|
let(:instance) { klass.new(valid_attributes) }
|
||||||
|
let(:valid_attributes) {
|
||||||
|
{
|
||||||
|
tag: "foo.bar",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe "#valid?" do
|
||||||
|
it "should be invalid if tag parameter lacked" do
|
||||||
|
params = valid_attributes.dup
|
||||||
|
params.delete(:tag)
|
||||||
|
klass.new(params).should_not be_valid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#plugin_type_name" do
|
||||||
|
subject { instance.plugin_type_name }
|
||||||
|
it { should == "syslog" }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#input_plugin" do
|
||||||
|
it { instance.should be_input_plugin }
|
||||||
|
it { instance.should_not be_output_plugin }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#to_config" do
|
||||||
|
subject { instance.to_config }
|
||||||
|
it { should include("type syslog") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
37
spec/models/fluentd/setting/out_td_spec.rb
Normal file
37
spec/models/fluentd/setting/out_td_spec.rb
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Fluentd::Setting::OutTd do
|
||||||
|
let(:klass) { described_class }
|
||||||
|
let(:instance) { klass.new(valid_attributes) }
|
||||||
|
let(:valid_attributes) {
|
||||||
|
{
|
||||||
|
match: "td.*.*",
|
||||||
|
apikey: "APIKEY",
|
||||||
|
auto_create_table: "true",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe "#valid?" do
|
||||||
|
it "should be invalid if tag parameter lacked" do
|
||||||
|
params = valid_attributes.dup
|
||||||
|
params.delete(:match)
|
||||||
|
klass.new(params).should_not be_valid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#plugin_type_name" do
|
||||||
|
subject { instance.plugin_type_name }
|
||||||
|
it { should == "tdlog" }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#input_plugin" do
|
||||||
|
it { instance.should_not be_input_plugin }
|
||||||
|
it { instance.should be_output_plugin }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#to_config" do
|
||||||
|
subject { instance.to_config }
|
||||||
|
it { should include("type tdlog") }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user