Fix tests that broke as a result of recent changes

Fixes #5472
This commit is contained in:
Jordan Sissel 2016-06-17 11:36:48 -07:00
parent d2400ac93a
commit 246a2e7ad3
3 changed files with 6 additions and 5 deletions

View file

@ -82,7 +82,7 @@ describe LogStash::FilterDelegator do
end end
end end
context "when the fitler create more events" do context "when the filter create more events" do
let(:plugin_klass) do let(:plugin_klass) do
Class.new(LogStash::Filters::Base) do Class.new(LogStash::Filters::Base) do
config_name "super_plugin" config_name "super_plugin"

View file

@ -67,15 +67,15 @@ describe LogStash::Instrument::Metric do
context "#time" do context "#time" do
let(:sleep_time) { 2 } let(:sleep_time) { 2 }
let(:sleep_time_ms) { sleep_time * 1_000_000 } let(:sleep_time_ms) { sleep_time * 1_000 }
it "records the duration" do it "records the duration" do
subject.time(:root, :duration_ms) { sleep(sleep_time) } subject.time(:root, :duration_ms) { sleep(sleep_time) }
expect(collector.last).to be_within(sleep_time_ms).of(sleep_time_ms + 5000) expect(collector.last).to be_within(sleep_time_ms).of(sleep_time_ms + 5)
expect(collector[0]).to match(:root) expect(collector[0]).to match(:root)
expect(collector[1]).to be(:duration_ms) expect(collector[1]).to be(:duration_ms)
expect(collector[2]).to be(:mean) expect(collector[2]).to be(:counter)
end end
it "returns the value of the executed block" do it "returns the value of the executed block" do
@ -90,7 +90,7 @@ describe LogStash::Instrument::Metric do
expect(collector.last).to be_within(sleep_time_ms).of(sleep_time_ms + 0.1) expect(collector.last).to be_within(sleep_time_ms).of(sleep_time_ms + 0.1)
expect(collector[0]).to match(:root) expect(collector[0]).to match(:root)
expect(collector[1]).to be(:duration_ms) expect(collector[1]).to be(:duration_ms)
expect(collector[2]).to be(:mean) expect(collector[2]).to be(:counter)
end end
end end

View file

@ -19,6 +19,7 @@ describe LogStash::OutputDelegator do
allow(out_klass).to receive(:threadsafe?).and_return(false) allow(out_klass).to receive(:threadsafe?).and_return(false)
allow(out_klass).to receive(:workers_not_supported?).and_return(false) allow(out_klass).to receive(:workers_not_supported?).and_return(false)
allow(out_klass).to receive(:name).and_return("example") allow(out_klass).to receive(:name).and_return("example")
allow(out_klass).to receive(:config_name)
allow(out_inst).to receive(:register) allow(out_inst).to receive(:register)
allow(out_inst).to receive(:multi_receive) allow(out_inst).to receive(:multi_receive)
allow(out_inst).to receive(:metric=).with(any_args) allow(out_inst).to receive(:metric=).with(any_args)