From 99bde4febbf58b4f61a98458f59675c65c261f2d Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Tue, 14 Jul 2026 13:53:00 +0800 Subject: [PATCH] test: align deployment and lease contracts --- apps/device-host-agent/tests/test_lease.py | 20 ++++++++++++++++---- tests/test_deployment_config.py | 5 ++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/device-host-agent/tests/test_lease.py b/apps/device-host-agent/tests/test_lease.py index 9efcb66..e21cc45 100644 --- a/apps/device-host-agent/tests/test_lease.py +++ b/apps/device-host-agent/tests/test_lease.py @@ -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), diff --git a/tests/test_deployment_config.py b/tests/test_deployment_config.py index 9e10aeb..6fd2241 100644 --- a/tests/test_deployment_config.py +++ b/tests/test_deployment_config.py @@ -47,7 +47,7 @@ def test_compose_defines_database_control_plane_and_outbound_host_agent() -> Non ) & REMOVED_CREDENTIAL_SETTINGS -def test_deploy_compose_has_only_cloud_services_and_minimal_environment() -> None: +def test_deploy_compose_has_only_cloud_services_and_required_environment() -> None: compose = yaml.safe_load( (ROOT / "compose.deploy.yaml").read_text(encoding="utf-8") ) @@ -62,6 +62,7 @@ def test_deploy_compose_has_only_cloud_services_and_minimal_environment() -> Non "@postgres:5432/${POSTGRES_DB}" ), "CLOUD_TRUST_PROXY_HEADERS": "${CLOUD_TRUST_PROXY_HEADERS:-false}", + "CLOUD_LLM_PROVIDER_ENCRYPTION_KEY": "${CLOUD_LLM_PROVIDER_ENCRYPTION_KEY}", } @@ -90,5 +91,7 @@ def test_example_environment_contains_no_static_credentials() -> None: "POSTGRES_USER", "POSTGRES_PASSWORD", "CLOUD_API_PORT", + "CLOUD_LLM_PROVIDER_ENCRYPTION_KEY", } assert not set(values) & REMOVED_CREDENTIAL_SETTINGS + assert values["CLOUD_LLM_PROVIDER_ENCRYPTION_KEY"].startswith("change-me-")