From fdb9353138ecd4b4653b158377ad0b63448ee04c Mon Sep 17 00:00:00 2001 From: yen3 Date: Wed, 23 Nov 2022 16:32:34 +0100 Subject: [PATCH] dltlyse: Update message payload pattern after python-dlt bb8f5b8 --- dltlyse/core/analyser.py | 9 ++++++++- tests/unittests/test_analyser.py | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dltlyse/core/analyser.py b/dltlyse/core/analyser.py index adfda08..a6aae45 100644 --- a/dltlyse/core/analyser.py +++ b/dltlyse/core/analyser.py @@ -32,7 +32,14 @@ ] # Traces to buffer since they might be stored before lifecycle start message -BUFFER_MATCHES_MSG = {"apid": "DA1", "ctid": "DC1", "payload_decoded": "[connection_info ok] connected \00\00\00\00"} +BUFFER_MATCHES_MSG = { + "apid": "DA1", + "ctid": "DC1", + # Note there is a trailing space at the end of the str. The reason is due to an + # optimization that compares (using `__eq__` aka `==`) the exact string that gets + # extracted by python-dlt now with stripped nul bytes (\00) that existed before. + "payload_decoded": "[connection_info ok] connected ", +} BUFFER_MATCHES_ECUID = "XORA" DLT_LIFECYCLE_START = { "apid": "DLTD", diff --git a/tests/unittests/test_analyser.py b/tests/unittests/test_analyser.py index 0ea513b..3efd659 100644 --- a/tests/unittests/test_analyser.py +++ b/tests/unittests/test_analyser.py @@ -306,7 +306,7 @@ def test_run_analyse_call_plugin_with_exception(): def test_run_analyse_buffer_traces(): """Test to append traces to buffer""" dlt_msgs = [ - MockDLTMessage(apid="DA1", ctid="DC1", payload="[connection_info ok] connected \00\00\00\00"), + MockDLTMessage(apid="DA1", ctid="DC1", payload="[connection_info ok] connected "), MockDLTMessage(ecuid="XORA"), ]