Skip to content

Commit 4ddc662

Browse files
refactor: address review nits in health_check_timeout PR
- Remove unused mock_docker_workspace fixture parameter from test - Fix execute_command mock scope to be active during resume() - Shorten stale comment in resume() to match _start_container Co-authored-by: openhands <openhands@all-hands.dev>
1 parent 6d17707 commit 4ddc662

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

openhands-workspace/openhands/workspace/docker/workspace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,6 @@ def resume(self) -> None:
422422
if result.returncode != 0:
423423
raise RuntimeError(f"Failed to resume container: {result.stderr}")
424424

425-
# Wait for health after resuming (use same timeout as initial startup)
425+
# Wait for container to be healthy
426426
self._wait_for_health(timeout=self.health_check_timeout)
427427
logger.info(f"Container resumed: {self._container_id}")

tests/workspace/test_docker_workspace.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def test_docker_workspace_startup_uses_health_check_timeout():
226226
mock_wait.assert_called_once_with(timeout=60.0)
227227

228228

229-
def test_docker_workspace_resume_uses_health_check_timeout(mock_docker_workspace):
229+
def test_docker_workspace_resume_uses_health_check_timeout():
230230
"""Test that resume() passes health_check_timeout to _wait_for_health."""
231231
with patch.object(DockerWorkspace, "_start_container"):
232232
with patch("openhands.workspace.docker.workspace.execute_command") as mock_exec:
@@ -237,7 +237,10 @@ def test_docker_workspace_resume_uses_health_check_timeout(mock_docker_workspace
237237

238238
workspace._container_id = "container_id_123"
239239

240-
with patch.object(workspace, "_wait_for_health") as mock_wait:
240+
with (
241+
patch("openhands.workspace.docker.workspace.execute_command") as mock_exec,
242+
patch.object(workspace, "_wait_for_health") as mock_wait,
243+
):
241244
mock_exec.return_value = Mock(returncode=0, stdout="", stderr="")
242245
workspace.resume()
243246
mock_wait.assert_called_once_with(timeout=30.0)

0 commit comments

Comments
 (0)