develop: 补齐 integrations 后端适配器单元测试
This commit is contained in:
parent
a7730f6dad
commit
a06bc13a0e
@ -17,8 +17,6 @@ from fault_log_analyzer.integrations import (
|
||||
|
||||
|
||||
class TestElasticsearchSinkIndexName(unittest.TestCase):
|
||||
"""ElasticsearchSink 的索引命名逻辑(不依赖 ES 客户端即可测试)。"""
|
||||
|
||||
def test_index_name_monthly_rollover(self):
|
||||
sink = object.__new__(ElasticsearchSink)
|
||||
sink._index_pattern = "hms-fault-log-{yyyy.MM}"
|
||||
@ -41,9 +39,6 @@ class TestElasticsearchSinkIndexName(unittest.TestCase):
|
||||
|
||||
|
||||
class TestLazyImportBackends(unittest.TestCase):
|
||||
"""可选后端依赖(kafka/elasticsearch/pymysql/redis)未安装时,实例化应抛出
|
||||
明确的 RuntimeError,而非影响核心逻辑与单元测试。"""
|
||||
|
||||
def _assert_missing_dependency_raises_runtime_error(self, factory):
|
||||
with patch("builtins.__import__", side_effect=ImportError("no optional dependency")):
|
||||
with self.assertRaises(RuntimeError):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user