test: report gb32960 live command diagnostics
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled

This commit is contained in:
lingniu
2026-06-29 21:08:15 +08:00
parent 33ae76fc1c
commit b1bd67d4d2
2 changed files with 164 additions and 0 deletions

View File

@@ -73,6 +73,58 @@ class VehicleIngestLiveVerifyTest(unittest.TestCase):
self.assertIn("peer LIKE '115.29.187.%'", sql)
def test_gb32960_command_counts_sql_uses_same_peer_filter(self):
sql = live_verify.gb32960_command_count_sql(
date_from="2026-06-29 00:00:00",
date_to="2026-06-29 23:59:59",
peer_like="115.29.187.205",
)
self.assertIn("protocol = 'GB32960'", sql)
self.assertIn("peer LIKE '%115.29.187.205%'", sql)
self.assertIn("GROUP BY message_id", sql)
def test_gb32960_command_count_rows_include_command_names(self):
response = {
"code": 0,
"data": [
[2, 9],
[5, 3],
],
}
rows = live_verify.command_count_rows(response)
self.assertEqual(rows, [
{"messageId": 2, "command": "REALTIME_REPORT", "count": 9},
{"messageId": 5, "command": "PLATFORM_LOGIN", "count": 3},
])
def test_gb32960_recent_frame_rows_surface_peer_and_raw_uri(self):
response = {
"code": 0,
"data": [[
"2026-06-29T12:26:21.385Z",
5,
"",
"unknown:GB32960:f729d788b943630e",
"115.29.187.205:59630",
"archive://frame.bin",
]],
}
rows = live_verify.recent_frame_rows(response)
self.assertEqual(rows, [{
"ts": "2026-06-29T12:26:21.385Z",
"messageId": 5,
"command": "PLATFORM_LOGIN",
"vin": "",
"vehicleKey": "unknown:GB32960:f729d788b943630e",
"peer": "115.29.187.205:59630",
"rawUri": "archive://frame.bin",
}])
def test_jt808_location_sql_uses_dedicated_location_stable_without_protocol_filter(self):
sql = live_verify.jt808_location_count_sql(
date_from="2026-06-29 00:00:00",