spec/out_stats_spec.rb in fluent-plugin-stats-0.3.6 vs spec/out_stats_spec.rb in fluent-plugin-stats-0.4.0

- old
+ new

@@ -90,11 +90,11 @@ avg _avg$ ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, { + expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, { "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0 }) end it { emit } end @@ -109,14 +109,14 @@ zero_emit true ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, { + expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, { "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0 }) - expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, { + expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, { "4xx_count"=>0,"5xx_count"=>0,"reqtime_max"=>0,"reqtime_min"=>0,"reqtime_avg"=>0.0 }) end it { emit; empty_emit } end @@ -130,11 +130,11 @@ avg_keys reqtime_avg,not_found ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, { + expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, { "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0 }) end it { emit } end @@ -158,11 +158,11 @@ {"reqtime"=>2.000,"reqsize"=>20}, ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("stats.#{tag}", time, { + expect(driver.instance.router).to receive(:emit).with("stats.#{tag}", time, { "reqtime_sum"=>3.000,"reqtime_max"=>2.000,"reqtime_min"=>1.000,"reqtime_avg"=>1.500,"reqsize_sum"=>30 }) end it { emit } end @@ -174,11 +174,11 @@ sum _count$ ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("foo", time, { + expect(driver.instance.router).to receive(:emit).with("foo", time, { "4xx_count"=>6,"5xx_count"=>6 }) end it { emit } end @@ -191,11 +191,11 @@ ] end let(:tag) { 'foo.bar' } before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("foo.#{tag}", time, { + expect(driver.instance.router).to receive(:emit).with("foo.#{tag}", time, { "4xx_count"=>6,"5xx_count"=>6 }) end it { emit } end @@ -208,11 +208,11 @@ ] end let(:tag) { 'foo.bar' } before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("bar", time, { + expect(driver.instance.router).to receive(:emit).with("bar", time, { "4xx_count"=>6,"5xx_count"=>6 }) end it { emit } end @@ -225,11 +225,11 @@ ] end let(:tag) { 'foo.bar' } before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("#{tag}.foo", time, { + expect(driver.instance.router).to receive(:emit).with("#{tag}.foo", time, { "4xx_count"=>6,"5xx_count"=>6 }) end it { emit } end @@ -242,11 +242,11 @@ ] end let(:tag) { 'foo.bar' } before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("foo", time, { + expect(driver.instance.router).to receive(:emit).with("foo", time, { "4xx_count"=>6,"5xx_count"=>6 }) end it { emit } end @@ -259,11 +259,11 @@ ] end let(:tag) { 'foo.bar' } before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("foo", time, { + expect(driver.instance.router).to receive(:emit).with("foo", time, { "4xx_count"=>6,"5xx_count"=>6 }) end it { emit } end @@ -286,11 +286,11 @@ avg _avg$ ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("foo", time, { + expect(driver.instance.router).to receive(:emit).with("foo", time, { "4xx_count"=>12,"5xx_count"=>12,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0 }) end it { emit } end @@ -306,14 +306,14 @@ avg _avg$ ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("stats.foo.bar", time, { + expect(driver.instance.router).to receive(:emit).with("stats.foo.bar", time, { "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0 }) - expect(Fluent::Engine).to receive(:emit).with("stats.foo.bar2", time, { + expect(driver.instance.router).to receive(:emit).with("stats.foo.bar2", time, { "4xx_count"=>6,"5xx_count"=>6,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0 }) end it { emit } end @@ -330,11 +330,11 @@ avg _avg$ ] end before do allow(Fluent::Engine).to receive(:now).and_return(time) - expect(Fluent::Engine).to receive(:emit).with("stats.foo", time, { + expect(driver.instance.router).to receive(:emit).with("stats.foo", time, { "4xx_count"=>12,"5xx_count"=>12,"reqtime_max"=>6,"reqtime_min"=>1,"reqtime_avg"=>3.0 }) end it { emit } end @@ -370,12 +370,11 @@ loaded_matches = driver.instance.matches loaded_saved_at = driver.instance.saved_at loaded_saved_duration = driver.instance.saved_duration expect(loaded_matches).to eql(stored_matches) - expect(loaded_saved_at).to eql(stored_saved_at) + expect(loaded_saved_at.to_i).to eql(stored_saved_at.to_i) expect(loaded_saved_duration).to eql(stored_saved_duration) end end end end -