2727CAPTURE_DURATION_SECONDS = 10
2828
2929# DLT message identifiers for datarouter statistics
30-
31- APP_ID = "EXA"
32- CTX_ID = "DFLT"
30+ APP_ID = "DR"
31+ CTX_ID = "STAT"
3332
3433_QNX_DATAROUTER_CHECK_CMD = "/proc/boot/pidin | /proc/boot/grep datarouter"
3534_LINUX_DATAROUTER_CHECK_CMD = "ps -ef | grep datarouter | grep -v grep"
4140 "./datarouter --no_adaptive_runtime > /dev/null 2>&1 &"
4241)
4342_LINUX_DATAROUTER_START_CMD = "cd /usr/bin/datarouter && nohup ./datarouter --no_adaptive_runtime > /dev/null 2>&1 &"
44-
45-
46- _LOGGINGAPP_START_CMD = "cd /showcases/data/logging/logging_app/etc && nohup /showcases/bin/logging_app &"
4743# Multicast route directs all multicast traffic (224.0.0.0/4) out of the containers
4844# network interface required for DLT messages to reach the host via the Docker bridge.
4945_LINUX_CHECK_MULTICAST_ROUTE_CMD = "ip route add 224.0.0.0/4 dev eth0 2>/dev/null || true"
@@ -89,7 +85,7 @@ def datarouter_running(target):
8985 yield
9086
9187
92- def test_remote_logging (datarouter_running , target , dlt_config ):
88+ def test_remote_logging (datarouter_running , dlt_config ):
9389 """Verifies remote logging of Dataraouter
9490
9591 Starts Datarouter on the target if not already running, then
@@ -104,10 +100,6 @@ def test_remote_logging(datarouter_running, target, dlt_config):
104100 print_to_stdout = True ,
105101 binary_path = dlt_config .dlt_receive_path ,
106102 ) as window :
107- logger .info ("Starting logging app to generate DLT messages.." )
108- exit_code , out = target .execute (_LOGGINGAPP_START_CMD )
109- logger .debug ("Logging app start command exit_code=%s" , exit_code )
110-
111103 time .sleep (CAPTURE_DURATION_SECONDS )
112104
113105 record = window .record (filters = [(APP_ID , CTX_ID )])
@@ -119,3 +111,46 @@ def test_remote_logging(datarouter_running, target, dlt_config):
119111 assert message_count > 1 , (
120112 f"Expected atleast one DLT message with app_id: { APP_ID } and context_id: { CTX_ID } , but got { message_count } "
121113 )
114+
115+
116+ # DLT message identifiers for the Logging App
117+ LOGGING_APP_ID = "EXA"
118+ LOGGING_CTX_ID = "DFLT"
119+
120+ _LOGGINGAPP_START_CMD = "cd /showcases/data/logging/logging_app/etc && nohup /showcases/bin/logging_app &"
121+
122+
123+ def test_logging_app_logs_forwarded_to_dlt (datarouter_running , target , dlt_config ):
124+ """Verifies that Logging App logs are forwarded to DLT."""
125+
126+ with DltWindow (
127+ protocol = Protocol .UDP ,
128+ host_ip = dlt_config .host_ip ,
129+ multicast_ips = dlt_config .multicast_ips ,
130+ print_to_stdout = True ,
131+ binary_path = dlt_config .dlt_receive_path ,
132+ ) as window :
133+ logger .info ("Starting logging_app..." )
134+ exit_code , out = target .execute (_LOGGINGAPP_START_CMD )
135+
136+ logger .info ("logging_app start exit_code=%s" , exit_code )
137+ logger .info (out .decode (errors = "replace" ))
138+
139+ assert exit_code == 0 , "Failed to start logging_app"
140+
141+ time .sleep (CAPTURE_DURATION_SECONDS )
142+
143+ record = window .record (filters = [(LOGGING_APP_ID , LOGGING_CTX_ID )])
144+ messages = record .find (query = dict (apid = LOGGING_APP_ID , ctid = LOGGING_CTX_ID ))
145+
146+ logger .debug (
147+ "Found %d messages with app_id=%s, context_id=%s" ,
148+ len (messages ),
149+ LOGGING_APP_ID ,
150+ LOGGING_CTX_ID ,
151+ )
152+
153+ assert len (messages ) > 0 , (
154+ f"Expected at least one DLT message with app_id={ LOGGING_APP_ID } "
155+ f"and context_id={ LOGGING_CTX_ID } , but got { len (messages )} "
156+ )
0 commit comments