test: verify gb32960 history tables in production smoke
This commit is contained in:
@@ -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
|
python3 tools/go_native_prod_smoke.py --date 2026-07-02 --timeout 8
|
||||||
```
|
```
|
||||||
|
|
||||||
该脚本通过 `20210` HTTP API 验证 GB32960、JT808、宇通 MQTT 的 RAW 查询,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 的位置和里程点查询,GB32960/JT808 的 `daily_mileage_km`、`daily_total_mileage_km` 统计,以及三类协议的 Redis realtime snapshot、online、protocol 查询。默认检查今天东八区数据时,还会要求三类 RAW 最新样本不超过 15 分钟,避免旧数据误判为接收正常;任一检查不达标时退出码为非 0。
|
||||||
|
|
||||||
## 部署命令
|
## 部署命令
|
||||||
|
|
||||||
@@ -188,5 +188,6 @@ journalctl -u lingniu-go-realtime-api --since '5 minutes ago' --no-pager
|
|||||||
- `realtime-api` 正在监听 `20210`。
|
- `realtime-api` 正在监听 `20210`。
|
||||||
- GB32960、JT808、YUTONG_MQTT 的东八区 RAW 查询均可命中生产数据。
|
- GB32960、JT808、YUTONG_MQTT 的东八区 RAW 查询均可命中生产数据。
|
||||||
- GB32960、JT808、YUTONG_MQTT 的最新 RAW 样本均在 15 分钟内。
|
- GB32960、JT808、YUTONG_MQTT 的最新 RAW 样本均在 15 分钟内。
|
||||||
|
- GB32960 和 JT808 的 `vehicle_locations`、`vehicle_mileage_points` 查询均可命中生产数据。
|
||||||
- `vehicle_daily_metric` 可查到 `daily_mileage_km` 和 `daily_total_mileage_km`。
|
- `vehicle_daily_metric` 可查到 `daily_mileage_km` 和 `daily_total_mileage_km`。
|
||||||
- Redis realtime 可查到 GB32960、JT808、YUTONG_MQTT 的在线状态和协议快照。
|
- Redis realtime 可查到 GB32960、JT808、YUTONG_MQTT 的在线状态和协议快照。
|
||||||
|
|||||||
@@ -182,7 +182,8 @@ def build_check_specs(
|
|||||||
max_raw_age_minutes: float | None = None,
|
max_raw_age_minutes: float | None = None,
|
||||||
) -> list[CheckSpec]:
|
) -> list[CheckSpec]:
|
||||||
raw_params = {"dateFrom": date_from, "dateTo": date_to, "limit": 1}
|
raw_params = {"dateFrom": date_from, "dateTo": date_to, "limit": 1}
|
||||||
history_params = {"protocol": "JT808", "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}
|
||||||
return [
|
return [
|
||||||
CheckSpec(
|
CheckSpec(
|
||||||
"gb32960.raw",
|
"gb32960.raw",
|
||||||
@@ -205,8 +206,10 @@ def build_check_specs(
|
|||||||
min_raw,
|
min_raw,
|
||||||
max_age_minutes=max_raw_age_minutes,
|
max_age_minutes=max_raw_age_minutes,
|
||||||
),
|
),
|
||||||
CheckSpec("jt808.locations", "/api/history/locations", history_params, min_history),
|
CheckSpec("gb32960.locations", "/api/history/locations", gb32960_history_params, min_history),
|
||||||
CheckSpec("jt808.mileage_points", "/api/history/mileage-points", history_params, min_history),
|
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(
|
CheckSpec(
|
||||||
"gb32960.daily_mileage",
|
"gb32960.daily_mileage",
|
||||||
"/api/stats/daily-metrics",
|
"/api/stats/daily-metrics",
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ class GoNativeProdSmokeTest(unittest.TestCase):
|
|||||||
self.assertIn("gb32960.raw", names)
|
self.assertIn("gb32960.raw", names)
|
||||||
self.assertIn("jt808.raw", names)
|
self.assertIn("jt808.raw", names)
|
||||||
self.assertIn("yutong_mqtt.raw", names)
|
self.assertIn("yutong_mqtt.raw", names)
|
||||||
|
self.assertIn("gb32960.locations", names)
|
||||||
|
self.assertIn("gb32960.mileage_points", names)
|
||||||
self.assertIn("jt808.locations", names)
|
self.assertIn("jt808.locations", names)
|
||||||
self.assertIn("jt808.mileage_points", names)
|
self.assertIn("jt808.mileage_points", names)
|
||||||
self.assertIn("gb32960.daily_mileage", names)
|
self.assertIn("gb32960.daily_mileage", names)
|
||||||
|
|||||||
Reference in New Issue
Block a user