mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
parent
d2400ac93a
commit
246a2e7ad3
3 changed files with 6 additions and 5 deletions
|
@ -82,7 +82,7 @@ describe LogStash::FilterDelegator do
|
|||
end
|
||||
end
|
||||
|
||||
context "when the fitler create more events" do
|
||||
context "when the filter create more events" do
|
||||
let(:plugin_klass) do
|
||||
Class.new(LogStash::Filters::Base) do
|
||||
config_name "super_plugin"
|
||||
|
|
|
@ -67,15 +67,15 @@ describe LogStash::Instrument::Metric do
|
|||
|
||||
context "#time" do
|
||||
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
|
||||
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[1]).to be(:duration_ms)
|
||||
expect(collector[2]).to be(:mean)
|
||||
expect(collector[2]).to be(:counter)
|
||||
end
|
||||
|
||||
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[0]).to match(:root)
|
||||
expect(collector[1]).to be(:duration_ms)
|
||||
expect(collector[2]).to be(:mean)
|
||||
expect(collector[2]).to be(:counter)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ describe LogStash::OutputDelegator do
|
|||
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(:name).and_return("example")
|
||||
allow(out_klass).to receive(:config_name)
|
||||
allow(out_inst).to receive(:register)
|
||||
allow(out_inst).to receive(:multi_receive)
|
||||
allow(out_inst).to receive(:metric=).with(any_args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue