fix: prevent tdengine raw frame overwrite
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import pathlib
|
||||
import types
|
||||
import unittest
|
||||
|
||||
from tools import jt808_e2e_smoke as smoke
|
||||
@@ -33,6 +34,47 @@ class Jt808E2ESmokeTest(unittest.TestCase):
|
||||
|
||||
self.assertEqual(path, pathlib.Path("/tmp/archive/2026/06/29/JT808/unknown/frame.bin"))
|
||||
|
||||
def test_raw_frame_count_sql_filters_by_vehicle_key_phone_and_raw_uri(self):
|
||||
sql = smoke.raw_frame_count_sql("13079961234", [
|
||||
{
|
||||
"vehicleKey": "jt808:13079961234",
|
||||
"rawUri": "archive://2026/06/29/JT808/13079961234/frame.bin",
|
||||
},
|
||||
])
|
||||
|
||||
self.assertEqual(
|
||||
sql,
|
||||
"SELECT COUNT(*) FROM raw_frames WHERE protocol = 'JT808' "
|
||||
"AND vehicle_key = 'jt808:13079961234' "
|
||||
"AND phone = '13079961234' "
|
||||
"AND raw_uri = 'archive://2026/06/29/JT808/13079961234/frame.bin'",
|
||||
)
|
||||
|
||||
def test_raw_frame_count_sqls_include_each_unique_visible_raw_uri(self):
|
||||
sqls = smoke.raw_frame_count_sqls("13079961234", [
|
||||
{
|
||||
"vehicleKey": "jt808:13079961234",
|
||||
"rawUri": "archive://2026/06/29/JT808/13079961234/frame-1.bin",
|
||||
},
|
||||
{
|
||||
"vehicleKey": "jt808:13079961234",
|
||||
"rawUri": "archive://2026/06/29/JT808/13079961234/frame-2.bin",
|
||||
},
|
||||
{
|
||||
"vehicleKey": "jt808:13079961234",
|
||||
"rawUri": "archive://2026/06/29/JT808/13079961234/frame-1.bin",
|
||||
},
|
||||
])
|
||||
|
||||
self.assertEqual(len(sqls), 2)
|
||||
self.assertTrue(sqls[0].endswith("frame-1.bin'"))
|
||||
self.assertTrue(sqls[1].endswith("frame-2.bin'"))
|
||||
|
||||
def test_expected_history_count_waits_for_pagination_sample(self):
|
||||
args = types.SimpleNamespace(frames=3, expect_history_count=1, verify_pagination=True)
|
||||
|
||||
self.assertEqual(smoke.expected_history_count(args), 2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user