Skip to content

fix: reject output conditions with unknown matcher keys#783

Open
saschabuehrle wants to merge 1 commit intowarpstreamlabs:mainfrom
saschabuehrle:fix/issue-382
Open

fix: reject output conditions with unknown matcher keys#783
saschabuehrle wants to merge 1 commit intowarpstreamlabs:mainfrom
saschabuehrle:fix/issue-382

Conversation

@saschabuehrle
Copy link
Copy Markdown

Bug

Fixes #382. A typo in an matcher key can currently pass silently. Unknown matcher keys are dropped during parsing, leaving an empty condition map that acts as a no-op and lets the test pass.

Fix

  • Treat empty parsed output condition blocks as invalid and return a parser error.
  • Parse only when it actually contains keys, so it no longer masks empty/unknown matcher blocks.
  • Added regression coverage for a condition block that only contains an unknown matcher.

Validation

This keeps valid test cases unchanged while failing fast on matcher typos.

Greetings, saschabuehrle

Comment on lines +123 to +126
var tmpMap map[string]*docs.ParsedConfig
if tmpMap, err = pConf.FieldAnyMap(fieldOutputMetadataEquals); err != nil {
return
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me. Can you provide an example of failing (and passing) YAML? Just want to make sure I am understanding the scope of this change correctly 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit test output_batches will pass tests with random words as "matcher" types

2 participants