magnusbaeck / logstash-filter-verifier

Apache License 2.0
192 stars 27 forks source link

Question: How to test dropped events #87

Closed RobCoops closed 3 years ago

RobCoops commented 4 years ago

I'm trying to test a logstash config that drops certain events using a simple: drop { }

But I am not sure how to go about this: expected: [ ] Results in my test being skipped, it seems. But doing this: expected: [ { } ] Results in a complaint about expecting 4 results and only getting 3, which I totally agree with. So I am wondering if this is a case of unclear output in the first case where the input is actually fed to logstash and there is no output returned thus all is good or if this is something that is not yet possible with this otherwise very handy tool.

magnusbaeck commented 4 years ago

If you want to assert that zero events are produced then expected: [] should work (see #80). What makes you think the tests are being skipped? Output from the command execution and the contents of the test case file would be useful.

breml commented 3 years ago

This works for me, if you have a test case file with just the events, that you expect to be dropped, and you add expected: [ ] as mentioned by @magnusbaeck.

magnusbaeck commented 3 years ago

Closing issue due to lack of feedback from issue creator.