init
This commit is contained in:
28
tests/test_health_check.py
Normal file
28
tests/test_health_check.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""健康检查测试"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
|
||||
|
||||
def test_set_status():
|
||||
"""测试状态设置"""
|
||||
from utils.health_check import set_qingjian_connected, set_wechat_ok
|
||||
set_qingjian_connected(True)
|
||||
set_qingjian_connected(False)
|
||||
set_wechat_ok(True)
|
||||
print("health check status OK")
|
||||
|
||||
|
||||
async def test_run_check():
|
||||
"""测试执行健康检查(不实际发告警)"""
|
||||
from utils.health_check import run_health_check
|
||||
await run_health_check(lambda: True)
|
||||
print("health check run OK")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import asyncio
|
||||
test_set_status()
|
||||
asyncio.run(test_run_check())
|
||||
print("All health check tests passed")
|
||||
Reference in New Issue
Block a user