Skip to content

Commit

Permalink
filterx: add light test for condition-expression value return on miss…
Browse files Browse the repository at this point in the history
…ing true branch stmts

Signed-off-by: shifter <[email protected]>
  • Loading branch information
bshifter committed Apr 17, 2024
1 parent 02fb61a commit c9fda74
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/light/functional_tests/filterx/test_filterx.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,20 @@ def test_tenary_operator_inline_tenary_expression_false(config, syslog_ng):
assert file_true.read_log() == "inner:false\n"


def test_tenary_return_condition_expression_value_without_true_branch(config, syslog_ng):
(file_true, file_false) = create_config(
config, """
$MSG = (${values.true_string}?:${values.false_string});
""",
)

syslog_ng.start(config)

assert file_true.get_stats()["processed"] == 1
assert "processed" not in file_false.get_stats()
assert file_true.read_log() == "boolean:true\n"


def test_if_condition_without_else_branch_match(config, syslog_ng):
(file_true, file_false) = create_config(
config, """
Expand Down

0 comments on commit c9fda74

Please sign in to comment.