test: align deployment and lease contracts
Tests / Test passed: 748

This commit is contained in:
2026-07-14 13:53:00 +08:00
parent 9afbdc91fa
commit 99bde4febb
2 changed files with 20 additions and 5 deletions
+16 -4
View File
@@ -34,8 +34,11 @@ def test_lease_renews_while_execution_is_active() -> None:
release_execution.wait(timeout=2)
return AssignmentExecutionResult(status="done")
def latest_progress(self):
return None
class RenewingClient:
async def renew(self, assignment):
async def renew(self, assignment, *, progress=None):
renewed.set()
return LeaseRenewalResponse(
status="renewed",
@@ -78,8 +81,11 @@ def test_stale_lease_stops_later_interruptible_actions() -> None:
failure_reason="execution interrupted",
)
def latest_progress(self):
return None
class StaleClient:
async def renew(self, assignment):
async def renew(self, assignment, *, progress=None):
assert await asyncio.to_thread(first_action_started.wait, 1)
raise StaleLeaseError(409, "stale lease")
@@ -105,8 +111,11 @@ def test_renewal_loop_exits_when_execution_finishes() -> None:
def execute(self, assignment, *, should_stop=None):
return AssignmentExecutionResult(status="done")
def latest_progress(self):
return None
class CountingClient:
async def renew(self, assignment):
async def renew(self, assignment, *, progress=None):
nonlocal renew_calls
renew_calls += 1
return LeaseRenewalResponse(
@@ -143,8 +152,11 @@ def test_shutdown_request_stops_active_execution_cooperatively() -> None:
failure_reason="execution interrupted",
)
def latest_progress(self):
return None
class RenewingClient:
async def renew(self, assignment):
async def renew(self, assignment, *, progress=None):
return LeaseRenewalResponse(
status="renewed",
lease_expires_at=datetime.now(UTC) + timedelta(seconds=30),