diff --git a/data/containers/patches.yaml b/data/containers/patches.yaml index 0c70365700ec..c8f767e22bcd 100644 --- a/data/containers/patches.yaml +++ b/data/containers/patches.yaml @@ -70,6 +70,7 @@ docker-py: # https://github.com/docker/docker-py/pull/3372 - test_connect_with_ipv6_address: enable IPv6 # https://github.com/docker/docker-py/pull/3373 - test_create_with_ipv6_address: enable IPv6 # https://github.com/docker/docker-py/pull/3380 - integration: Remove test_build_squash tests + # https://github.com/docker/docker-py/pull/3393 - tests: Make stream assertions robust to chunk splitting 3261: 3290: 3354: @@ -79,6 +80,7 @@ docker-py: 3372: 3373: 3380: + 3393: moby: # https://github.com/moby/moby/pull/51219 - integration/container: Make tests runnable on SELinux enabled daemon diff --git a/data/containers/patches/docker-py/3393.patch b/data/containers/patches/docker-py/3393.patch new file mode 100644 index 000000000000..d101a1f28fbb --- /dev/null +++ b/data/containers/patches/docker-py/3393.patch @@ -0,0 +1,52 @@ +From 41fea2f8923036621c209afebf32c912d5c637e4 Mon Sep 17 00:00:00 2001 +From: Ricardo Branco +Date: Wed, 1 Apr 2026 21:06:10 +0200 +Subject: [PATCH] tests: Make stream assertions robust to chunk splitting + +When tty=True the output can be split across multiple stream chunks +instead of aligning on line boundaries, making exact chunk membership +checks unreliable. + +Verify that the expected messages are present in the combined stream +output rather than at specific chunk boundaries. + +Signed-off-by: Ricardo Branco +--- + tests/integration/api_exec_test.py | 20 ++++++-------------- + 1 file changed, 6 insertions(+), 14 deletions(-) + +diff --git a/tests/integration/api_exec_test.py b/tests/integration/api_exec_test.py +index 5b829e2875..15080907c4 100644 +--- a/tests/integration/api_exec_test.py ++++ b/tests/integration/api_exec_test.py +@@ -286,13 +286,9 @@ def test_exec_command_tty_stream_no_demux(self): + # tty=True, stream=True, demux=False + res = self.client.exec_create(self.container, self.cmd, tty=True) + exec_log = list(self.client.exec_start(res, stream=True)) +- assert b'hello out\r\n' in exec_log +- if len(exec_log) == 2: +- assert b'hello err\r\n' in exec_log +- else: +- assert len(exec_log) == 3 +- assert b'hello err' in exec_log +- assert b'\r\n' in exec_log ++ merged = b''.join(chunk for chunk in exec_log) ++ assert b'hello out\r\n' in merged ++ assert b'hello err\r\n' in merged + + def test_exec_command_tty_no_stream_demux(self): + # tty=True, stream=False, demux=True +@@ -304,10 +300,6 @@ def test_exec_command_tty_stream_demux(self): + # tty=True, stream=True, demux=True + res = self.client.exec_create(self.container, self.cmd, tty=True) + exec_log = list(self.client.exec_start(res, demux=True, stream=True)) +- assert (b'hello out\r\n', None) in exec_log +- if len(exec_log) == 2: +- assert (b'hello err\r\n', None) in exec_log +- else: +- assert len(exec_log) == 3 +- assert (b'hello err', None) in exec_log +- assert (b'\r\n', None) in exec_log ++ merged = b''.join(chunk for chunk, _ in exec_log) ++ assert b'hello out\r\n' in merged ++ assert b'hello err\r\n' in merged diff --git a/tests/containers/python_docker.pm b/tests/containers/python_docker.pm index 101b3e9ca988..45ffff7d3691 100644 --- a/tests/containers/python_docker.pm +++ b/tests/containers/python_docker.pm @@ -82,8 +82,6 @@ sub test ($target) { "tests.integration.api_container_test.AttachContainerTest::test_attach_no_stream", # This test with websockets is broken "tests.integration.api_container_test.AttachContainerTest::test_run_container_reading_socket_ws", - "tests.integration.api_exec_test.ExecDemuxTest::test_exec_command_tty_stream_demux", - "tests.integration.api_exec_test.ExecDemuxTest::test_exec_command_tty_stream_no_demux", # https://github.com/docker/docker-py/issues/3389 "tests.integration.api_network_test.TestNetworks::test_connect_with_mac_address", );