fix: 修正CGI并固定数据库配置
This commit is contained in:
+12
-21
@@ -37,8 +37,11 @@ class PipelineTest(unittest.TestCase):
|
||||
rows = list(csv.DictReader(file))
|
||||
self.assertEqual(len(rows), 7)
|
||||
self.assertEqual({row["source_type"] for row in rows}, set(main.EXPECTED_TYPES))
|
||||
self.assertIn("460-00-100-1", {row["cgi"] for row in rows})
|
||||
self.assertIn("46000-100-1", {row["cgi"] for row in rows})
|
||||
rows_by_type = {row["source_type"]: row for row in rows}
|
||||
self.assertEqual(rows_by_type["5G干扰监控"]["cgi"], "460-00-200-1")
|
||||
self.assertEqual(rows_by_type["700M干扰监控"]["cgi"], "460-00-200-1")
|
||||
for source_type in set(main.EXPECTED_TYPES) - {"5G干扰监控", "700M干扰监控"}:
|
||||
self.assertEqual(rows_by_type[source_type]["cgi"], "460-00-100-1")
|
||||
self.assertTrue(all(row["interference_dbm"] == "-100.5" for row in rows))
|
||||
|
||||
manifest = json.loads((result / "manifest.json").read_text(encoding="utf-8"))
|
||||
@@ -74,14 +77,7 @@ class PipelineTest(unittest.TestCase):
|
||||
|
||||
def test_mysql_store_replaces_same_hour_and_deletes_other_hours(self) -> None:
|
||||
connection = FakeConnection(datetime(2026, 7, 31, 10), same_hour_rows=7, old_rows=20)
|
||||
store = main.MySQLSummaryStore(
|
||||
host="",
|
||||
port=3306,
|
||||
user="",
|
||||
password="",
|
||||
database="",
|
||||
connect_factory=lambda: connection,
|
||||
)
|
||||
store = main.MySQLSummaryStore(connect_factory=lambda: connection)
|
||||
|
||||
result = store.replace_latest([database_row()])
|
||||
|
||||
@@ -96,14 +92,7 @@ class PipelineTest(unittest.TestCase):
|
||||
|
||||
def test_mysql_store_refuses_to_replace_a_newer_hour(self) -> None:
|
||||
connection = FakeConnection(datetime(2026, 7, 31, 11))
|
||||
store = main.MySQLSummaryStore(
|
||||
host="",
|
||||
port=3306,
|
||||
user="",
|
||||
password="",
|
||||
database="",
|
||||
connect_factory=lambda: connection,
|
||||
)
|
||||
store = main.MySQLSummaryStore(connect_factory=lambda: connection)
|
||||
|
||||
with self.assertRaisesRegex(main.ProcessingError, "already contains newer metric time"):
|
||||
store.replace_latest([database_row()])
|
||||
@@ -122,7 +111,7 @@ class RecordingStore:
|
||||
self.rows = list(rows)
|
||||
return {
|
||||
"enabled": True,
|
||||
"table": main.DEFAULT_DB_TABLE,
|
||||
"table": main.DATABASE_TABLE,
|
||||
"metric_time": rows[0]["hour_start"],
|
||||
"inserted_rows": len(rows),
|
||||
"refreshed_rows": 0,
|
||||
@@ -183,7 +172,7 @@ def database_row() -> dict[str, str]:
|
||||
"hour_start": "2026-07-31 10:00:00",
|
||||
"hour_end": "2026-07-31 11:00:00",
|
||||
"source_type": "5G干扰监控",
|
||||
"cgi": "46000-100-1",
|
||||
"cgi": "460-00-200-1",
|
||||
"cell_name": "测试小区",
|
||||
"interference_dbm": "-100.5",
|
||||
"source_path": "/source.zip",
|
||||
@@ -220,9 +209,11 @@ def mock_row(source_type: str, window: str) -> list[object]:
|
||||
"粒度": "1 小时",
|
||||
"eNodeBId": 100,
|
||||
"eNodeBID": 100,
|
||||
"gNBId": 200,
|
||||
"gNBplmn": "460-00",
|
||||
"cellId": 1,
|
||||
"小区ID": 1,
|
||||
"masterOperatorId": "46000-100-1",
|
||||
"masterOperatorId": "unused-source-value",
|
||||
"E-UTRAN FDD小区名称": f"{source_type}-小区",
|
||||
"E-UTRAN TDD小区名称": f"{source_type}-小区",
|
||||
"CU小区配置名称": f"{source_type}-小区",
|
||||
|
||||
Reference in New Issue
Block a user