test: verify mqtt history tables in production smoke

This commit is contained in:
lingniu
2026-07-02 01:41:08 +08:00
parent 576644eb65
commit 4e8434c511
3 changed files with 7 additions and 2 deletions

View File

@@ -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 分钟内。
- GB32960JT808 的 `vehicle_locations``vehicle_mileage_points` 查询均可命中生产数据。
- GB32960JT808、YUTONG_MQTT`vehicle_locations``vehicle_mileage_points` 查询均可命中生产数据。
- `vehicle_daily_metric` 可查到 `daily_mileage_km``daily_total_mileage_km`
- Redis realtime 可查到 GB32960、JT808、YUTONG_MQTT 的在线状态和协议快照。

View File

@@ -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",

View File

@@ -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)