spec/out_grepcounter_spec.rb in fluent-plugin-grepcounter-0.5.3 vs spec/out_grepcounter_spec.rb in fluent-plugin-grepcounter-0.5.4
- old
+ new
@@ -353,9 +353,49 @@
Fluent::Engine.should_receive(:emit).with("foo.foo.foo", time, expected)
end
it { emit }
end
+ context 'add_tag_prefix.' do
+ let(:config) { CONFIG + %[add_tag_prefix foo.] }
+ let(:tag) { 'syslog.host1' }
+ before do
+ Fluent::Engine.stub(:now).and_return(time)
+ Fluent::Engine.should_receive(:emit).with("foo.#{tag}", time, expected)
+ end
+ it { emit }
+ end
+
+ context 'remove_tag_prefix.' do
+ let(:config) { CONFIG + %[remove_tag_prefix syslog.] }
+ let(:tag) { 'syslog.host1' }
+ before do
+ Fluent::Engine.stub(:now).and_return(time)
+ Fluent::Engine.should_receive(:emit).with("host1", time, expected)
+ end
+ it { emit }
+ end
+
+ context '.add_tag_suffix' do
+ let(:config) { CONFIG + %[add_tag_suffix .foo] }
+ let(:tag) { 'syslog.host1' }
+ before do
+ Fluent::Engine.stub(:now).and_return(time)
+ Fluent::Engine.should_receive(:emit).with("#{tag}.foo", time, expected)
+ end
+ it { emit }
+ end
+
+ context '.remove_tag_suffix' do
+ let(:config) { CONFIG + %[remove_tag_suffix .host1] }
+ let(:tag) { 'syslog.host1' }
+ before do
+ Fluent::Engine.stub(:now).and_return(time)
+ Fluent::Engine.should_receive(:emit).with("syslog", time, expected)
+ end
+ it { emit }
+ end
+
context 'output_with_joined_delimiter (obsolete)' do
# \\n shall be \n in config file
let(:config) { CONFIG + %[output_with_joined_delimiter \\n] }
before do
Fluent::Engine.stub(:now).and_return(time)