Fix docker.run_command() needing detach but not enforcing it (#5979)

* Fix `docker.run_command()` needing `detach` but not enforcing it

* Fix test
This commit is contained in:
Felipe Santos 2025-06-30 11:09:19 -03:00 committed by GitHub
parent cf32f036c0
commit d1c1a2d418
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -213,9 +213,6 @@ class DockerHomeAssistant(DockerInterface):
privileged=True,
init=True,
entrypoint=[],
detach=True,
stdout=True,
stderr=True,
mounts=[
Mount(
type=MountType.BIND.value,

View File

@ -313,6 +313,7 @@ class DockerAPI:
container = self.docker.containers.run(
image_with_tag,
command=command,
detach=True,
network=self.network.name,
use_config_proxy=False,
**kwargs,
@ -331,7 +332,7 @@ class DockerAPI:
with suppress(docker_errors.DockerException, requests.RequestException):
container.remove(force=True, v=True)
return CommandReturn(result.get("StatusCode"), output)
return CommandReturn(result["StatusCode"], output)
def repair(self) -> None:
"""Repair local docker overlayfs2 issues."""

View File

@ -34,6 +34,7 @@ async def test_run_command_success(docker: DockerAPI):
docker.docker.containers.run.assert_called_once_with(
"alpine:3.18",
command="echo hello",
detach=True,
network=docker.network.name,
use_config_proxy=False,
stdout=True,
@ -66,6 +67,7 @@ async def test_run_command_with_defaults(docker: DockerAPI):
docker.docker.containers.run.assert_called_once_with(
"ubuntu:latest", # default tag
command=None, # default command
detach=True,
network=docker.network.name,
use_config_proxy=False,
)