vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
17.3k stars 1.5k forks source link

unit test with multiple input passes although one input should fail it #15512

Open benzaita opened 1 year ago

benzaita commented 1 year ago

A note for the community

Problem

it seems like the outputs.conditions needs to be true only for a single event, even if there are multiple inputs. Is this intentional? Is there a way to require the condition to be true for all of the inputs?

The example below passes the tests although one input should fail it:

> vector test
Running tests
test foo ... passed

Configuration

[sources.in]
type = "stdin"

[transforms.filter]
type = "filter"
inputs = ["in"]
condition.type = "vrl"
condition.source = """
.message == "you-shall-pass"
"""

[sinks.console]
type = "console"
inputs = ["filter"]
encoding.codec = "json"

[[tests]]
name = "foo"

# will be dropped by the filter
[[tests.inputs]]
type = "log"
insert_at = "filter"
log_fields."message" = "should-be-dropped"

[[tests.inputs]]
type = "log"
insert_at = "filter"
log_fields."message" = "you-shall-pass"

[[tests.outputs]]
extract_from = "filter"

[[tests.outputs.conditions]]
type = "vrl"
source = """
assert_eq!(.message, "you-shall-pass")
"""

Version

vector 0.25.1 (x86_64-unknown-linux-gnu 9125a99 2022-11-07)

Debug Output

No response

Example Data

No response

Additional Context

No response

References

No response

bobelev commented 7 months ago

Any news on this? It seems frustrating to write tests that don't work themselves.