From 4e8434c511bc6e6a51dd9ca858fa7a36217f28b9 Mon Sep 17 00:00:00 2001 From: lingniu Date: Thu, 2 Jul 2026 01:41:08 +0800 Subject: [PATCH] test: verify mqtt history tables in production smoke --- docs/operations/current-ecs-deployment.md | 4 ++-- tools/go_native_prod_smoke.py | 3 +++ tools/test_go_native_prod_smoke.py | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/operations/current-ecs-deployment.md b/docs/operations/current-ecs-deployment.md index 7656ca64..3c2c3ce8 100644 --- a/docs/operations/current-ecs-deployment.md +++ b/docs/operations/current-ecs-deployment.md @@ -142,7 +142,7 @@ curl -sS 'http://115.29.187.205:20210/api/stats/daily-metrics?dateFrom=2026-07-0 python3 tools/go_native_prod_smoke.py --date 2026-07-02 --timeout 8 ``` -该脚本通过 `20210` HTTP API 验证 GB32960、JT808、宇通 MQTT 的 RAW 查询,GB32960/JT808 的位置和里程点查询,GB32960/JT808 的 `daily_mileage_km`、`daily_total_mileage_km` 统计,以及三类协议的 Redis realtime snapshot、online、protocol 查询。默认检查今天东八区数据时,还会要求三类 RAW 最新样本不超过 15 分钟,避免旧数据误判为接收正常;任一检查不达标时退出码为非 0。 +该脚本通过 `20210` HTTP API 验证 GB32960、JT808、宇通 MQTT 的 RAW 查询,三类协议的位置和里程点查询,GB32960/JT808 的 `daily_mileage_km`、`daily_total_mileage_km` 统计,以及三类协议的 Redis realtime snapshot、online、protocol 查询。默认检查今天东八区数据时,还会要求三类 RAW 最新样本不超过 15 分钟,避免旧数据误判为接收正常;任一检查不达标时退出码为非 0。 ## 部署命令 @@ -188,6 +188,6 @@ journalctl -u lingniu-go-realtime-api --since '5 minutes ago' --no-pager - `realtime-api` 正在监听 `20210`。 - GB32960、JT808、YUTONG_MQTT 的东八区 RAW 查询均可命中生产数据。 - GB32960、JT808、YUTONG_MQTT 的最新 RAW 样本均在 15 分钟内。 -- GB32960 和 JT808 的 `vehicle_locations`、`vehicle_mileage_points` 查询均可命中生产数据。 +- GB32960、JT808、YUTONG_MQTT 的 `vehicle_locations`、`vehicle_mileage_points` 查询均可命中生产数据。 - `vehicle_daily_metric` 可查到 `daily_mileage_km` 和 `daily_total_mileage_km`。 - Redis realtime 可查到 GB32960、JT808、YUTONG_MQTT 的在线状态和协议快照。 diff --git a/tools/go_native_prod_smoke.py b/tools/go_native_prod_smoke.py index c10b24d5..f53525e0 100755 --- a/tools/go_native_prod_smoke.py +++ b/tools/go_native_prod_smoke.py @@ -184,6 +184,7 @@ def build_check_specs( raw_params = {"dateFrom": date_from, "dateTo": date_to, "limit": 1} gb32960_history_params = {"protocol": "GB32960", "dateFrom": date_from, "dateTo": date_to, "limit": 1} jt808_history_params = {"protocol": "JT808", "dateFrom": date_from, "dateTo": date_to, "limit": 1} + yutong_mqtt_history_params = {"protocol": "YUTONG_MQTT", "dateFrom": date_from, "dateTo": date_to, "limit": 1} return [ CheckSpec( "gb32960.raw", @@ -210,6 +211,8 @@ def build_check_specs( CheckSpec("gb32960.mileage_points", "/api/history/mileage-points", gb32960_history_params, min_history), CheckSpec("jt808.locations", "/api/history/locations", jt808_history_params, min_history), CheckSpec("jt808.mileage_points", "/api/history/mileage-points", jt808_history_params, min_history), + CheckSpec("yutong_mqtt.locations", "/api/history/locations", yutong_mqtt_history_params, min_history), + CheckSpec("yutong_mqtt.mileage_points", "/api/history/mileage-points", yutong_mqtt_history_params, min_history), CheckSpec( "gb32960.daily_mileage", "/api/stats/daily-metrics", diff --git a/tools/test_go_native_prod_smoke.py b/tools/test_go_native_prod_smoke.py index 7156df51..cefb09d2 100644 --- a/tools/test_go_native_prod_smoke.py +++ b/tools/test_go_native_prod_smoke.py @@ -77,6 +77,8 @@ class GoNativeProdSmokeTest(unittest.TestCase): self.assertIn("gb32960.mileage_points", names) self.assertIn("jt808.locations", names) self.assertIn("jt808.mileage_points", names) + self.assertIn("yutong_mqtt.locations", names) + self.assertIn("yutong_mqtt.mileage_points", names) self.assertIn("gb32960.daily_mileage", names) self.assertIn("jt808.daily_total_mileage", names)