Skip to content

Commit

Permalink
filterx: add light test for pubsub attributes empty values handling
Browse files Browse the repository at this point in the history
Signed-off-by: shifter <[email protected]>
  • Loading branch information
bshifter committed Jan 22, 2025
1 parent b53ad72 commit 5c278db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/light/functional_tests/filterx/test_filterx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2634,13 +2634,15 @@ def test_pubsub_message(config, syslog_ng):
config, r"""
$MSG = json();
$MSG.msg = pubsub_message("my pubsub message", {"foo":"bar"});
$MSG.empty = pubsub_message("empty attribute value", {"empty":""});
""",
)
syslog_ng.start(config)

assert file_true.get_stats()["processed"] == 1
assert "processed" not in file_false.get_stats()
exp = (
r"""{"msg":{"data":"my pubsub message","attributes":{"foo":"bar"}}}""" + "\n"
r"""{"msg":{"data":"my pubsub message","attributes":{"foo":"bar"}},"""
""""empty":{"data":"empty attribute value","attributes":{"empty":""}}}""" + "\n"
)
assert file_true.read_log() == exp

0 comments on commit 5c278db

Please sign in to comment.