test(host-repair): isolate redis repair lock
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled

This commit is contained in:
ogt
2026-07-10 00:42:41 +08:00
parent 2939a9aea4
commit 6789987a30

View File

@@ -9,6 +9,24 @@ import pytest
from unittest.mock import AsyncMock, patch
class _IsolatedRedisLock:
def __init__(self, *_args, **_kwargs):
self.acquired = False
async def acquire(self) -> bool:
self.acquired = True
return True
async def release(self) -> bool:
self.acquired = False
return True
@pytest.fixture(autouse=True)
def isolate_distributed_repair_lock(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr("src.core.redis_client.RedisLock", _IsolatedRedisLock)
# =============================================================================
# 測試 HostRepairConfig 路由
# =============================================================================