29 lines
765 B
Python
29 lines
765 B
Python
# -*- 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")
|