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
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:
@@ -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 路由
|
||||
# =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user