diff --git a/event_routing_backends/management/commands/helpers/queued_sender.py b/event_routing_backends/management/commands/helpers/queued_sender.py index 98a0ecf2..ad9af36e 100644 --- a/event_routing_backends/management/commands/helpers/queued_sender.py +++ b/event_routing_backends/management/commands/helpers/queued_sender.py @@ -51,7 +51,7 @@ def is_known_event(self, event): """ if "name" in event: for processor in self.engine.processors: - if event["name"] in processor.whitelist: + if event["name"] in processor.whitelist or event["name"] in processor.registry.mapping: return True return False diff --git a/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py b/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py index 6e781401..78df6f65 100644 --- a/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py +++ b/event_routing_backends/management/commands/tests/test_transform_tracking_logs.py @@ -76,6 +76,7 @@ def command_options(): "Sending to LRS!" ] }, + "registry_mapping": {"problem_check":1}, }, # Remote file to LRS dry run no batch size { @@ -94,6 +95,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 0 batches.", ] }, + "registry_mapping": {"problem_check":1}, }, # Remote file to LRS, default batch size { @@ -112,6 +114,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 1 batches.", ] }, + "whitelist": ["problem_check"] }, # Local file to remote file { @@ -135,6 +138,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 2 batches.", ] }, + "whitelist": ["problem_check"] }, # Remote file dry run { @@ -157,6 +161,7 @@ def command_options(): "Queued 2 log lines, could not parse 2 log lines, skipped 8 log lines, sent 0 batches.", ] }, + "whitelist": ["problem_check"] }, ] @@ -208,7 +213,8 @@ def test_transform_command(command_opts, mock_common_calls, caplog, capsys): mm2 = MagicMock() # Fake a router mapping so some events in the log are actually processed - mm2.whitelist = {"problem_check": 1} + mm2.registry.mapping = command_opts.pop("registry_mapping", {}) + mm2.whitelist = command_opts.pop("whitelist", []) # Fake a process response that can be serialized to json mm2.return_value = {"foo": "bar"} tracker.backends["event_transformer"].processors = [mm2] @@ -233,8 +239,6 @@ def test_transform_command(command_opts, mock_common_calls, caplog, capsys): assert "Expecting ',' delimiter: line 1 column 63 (char 62)" in caplog.text # Check the specific expected log lines for this set of options - print(caplog.text) - print(captured.out) for line in expected_results["log_lines"]: assert line in caplog.text or line in captured.out