Skip to content

Commit

Permalink
filterx: add light test for pubsub_message
Browse files Browse the repository at this point in the history
Signed-off-by: shifter <[email protected]>
  • Loading branch information
bshifter committed Jan 17, 2025
1 parent e894513 commit 471948f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/light/functional_tests/filterx/test_filterx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2627,3 +2627,20 @@ def test_keys(config, syslog_ng):
r""""direct_access":"foo"}""" + "\n"
)
assert file_true.read_log() == exp


def test_pubsub_message(config, syslog_ng):
(file_true, file_false) = create_config(
config, r"""
$MSG = json();
$MSG.msg = pubsub_message("my pubsub message", {"foo":"bar"});
""",
)
syslog_ng.start(config)

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

0 comments on commit 471948f

Please sign in to comment.