spec/plugin/out_statsd_spec.rb in fluent-plugin-statsd-output-1.1.1 vs spec/plugin/out_statsd_spec.rb in fluent-plugin-statsd-output-1.2.0
- old
+ new
@@ -4,10 +4,11 @@
RSpec.describe Fluent::StatsdOutput do
let(:config) do
%{
type statsd
namespace a.b.c
+ batch_byte_size 512
<metric>
statsd_type timing
statsd_key res_time
statsd_val ${record['response_time']}
@@ -18,11 +19,17 @@
statsd_key res_code_${record['status'].to_i / 100}xx
</metric>
}
end
let(:driver) { create_driver(config) }
- let(:statsd) { double('statsd', increment: true, timing: true, 'namespace=' => true) }
+ let(:statsd) { double('statsd', increment: true,
+ timing: true,
+ 'namespace=' => true,
+ 'batch_size=' => true,
+ 'batch_byte_size' => true)
+
+ }
let(:time) { Time.now.utc }
before :all do
Fluent::Test.setup
end
@@ -39,9 +46,11 @@
it 'should call statsd with events data' do
allow(Statsd).to receive(:new).and_return(statsd)
expect(statsd).to receive(:namespace=).with('a.b.c')
+ expect(statsd).to receive(:batch_size=).with(nil)
+ expect(statsd).to receive(:batch_byte_size=).with(512)
expect(statsd).to receive(:increment).with('res_code_2xx').twice.times
expect(statsd).to receive(:increment).with('res_code_4xx').once.times
expect(statsd).to receive(:increment).with('res_code_5xx').once.times
expect(statsd).to receive(:timing).with('res_time', 102).ordered