mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -04:00
Slight tidying of specs
Any metric calls are now allowed. This should help us grow our metrics usage without accidentally failing tests that were too rigid. I also split some testing up to have more alignment between the 'it' description and the execution. Fixes #5472
This commit is contained in:
parent
6cb0b538e3
commit
a8282184f3
1 changed files with 18 additions and 6 deletions
|
@ -67,11 +67,17 @@ describe LogStash::FilterDelegator do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the filter buffer events" do
|
context "when the filter buffer events" do
|
||||||
it "doesn't increment out" do
|
before do
|
||||||
allow(metric).to receive(:increment).with(:time_ms, anything)
|
allow(metric).to receive(:increment).with(anything, anything)
|
||||||
expect(metric).to receive(:increment).with(:in, events.size)
|
end
|
||||||
expect(metric).not_to receive(:increment).with(:out, anything)
|
|
||||||
|
|
||||||
|
it "has incremented :in" do
|
||||||
|
expect(metric).to receive(:increment).with(:in, events.size)
|
||||||
|
subject.multi_filter(events)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "has not incremented :out" do
|
||||||
|
expect(metric).not_to receive(:increment).with(:out, anything)
|
||||||
subject.multi_filter(events)
|
subject.multi_filter(events)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -92,8 +98,11 @@ describe LogStash::FilterDelegator do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(metric).to receive(:increment).with(anything, anything)
|
||||||
|
end
|
||||||
|
|
||||||
it "increments the in/out of the metric" do
|
it "increments the in/out of the metric" do
|
||||||
allow(metric).to receive(:increment).with(:time_ms, anything)
|
|
||||||
expect(metric).to receive(:increment).with(:in, events.size)
|
expect(metric).to receive(:increment).with(:in, events.size)
|
||||||
expect(metric).to receive(:increment).with(:out, events.size * 2)
|
expect(metric).to receive(:increment).with(:out, events.size * 2)
|
||||||
|
|
||||||
|
@ -114,12 +123,15 @@ describe LogStash::FilterDelegator do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
allow(metric).to receive(:increment).with(anything, anything)
|
||||||
|
end
|
||||||
|
|
||||||
it "doesnt define a flush method" do
|
it "doesnt define a flush method" do
|
||||||
expect(subject.respond_to?(:flush)).to be_falsey
|
expect(subject.respond_to?(:flush)).to be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it "increments the in/out of the metric" do
|
it "increments the in/out of the metric" do
|
||||||
allow(metric).to receive(:increment).with(:time_ms, anything)
|
|
||||||
expect(metric).to receive(:increment).with(:in, events.size)
|
expect(metric).to receive(:increment).with(:in, events.size)
|
||||||
expect(metric).to receive(:increment).with(:out, events.size)
|
expect(metric).to receive(:increment).with(:out, events.size)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue