Skip to content
Merged
85 changes: 85 additions & 0 deletions data/containers/patches/docker-py/3261.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
From e47e966e944deb637a16f445abd5fc92f6dba38a Mon Sep 17 00:00:00 2001
From: Sebastiaan van Stijn <[email protected]>
Date: Wed, 22 May 2024 15:12:42 +0200
Subject: [PATCH] Bump default API version to 1.45 (Moby 26.0/26.1)

- Update API version to the latest maintained release.
0 Adjust tests for API 1.45

Signed-off-by: Sebastiaan van Stijn <[email protected]>
---
Makefile | 4 ++--
docker/constants.py | 2 +-
tests/Dockerfile-ssh-dind | 4 ++--
tests/integration/models_containers_test.py | 11 +++++------
4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 13a00f5e20..d1c07ac739 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-TEST_API_VERSION ?= 1.44
-TEST_ENGINE_VERSION ?= 25.0
+TEST_API_VERSION ?= 1.45
+TEST_ENGINE_VERSION ?= 26.1

ifeq ($(OS),Windows_NT)
PLATFORM := Windows
diff --git a/docker/constants.py b/docker/constants.py
index 3c527b47e3..0e39dc2917 100644
--- a/docker/constants.py
+++ b/docker/constants.py
@@ -2,7 +2,7 @@

from .version import __version__

-DEFAULT_DOCKER_API_VERSION = '1.44'
+DEFAULT_DOCKER_API_VERSION = '1.45'
MINIMUM_DOCKER_API_VERSION = '1.24'
DEFAULT_TIMEOUT_SECONDS = 60
STREAM_HEADER_SIZE_BYTES = 8
diff --git a/tests/Dockerfile-ssh-dind b/tests/Dockerfile-ssh-dind
index 250c20f2c8..49529f84b7 100644
--- a/tests/Dockerfile-ssh-dind
+++ b/tests/Dockerfile-ssh-dind
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1

-ARG API_VERSION=1.44
-ARG ENGINE_VERSION=25.0
+ARG API_VERSION=1.45
+ARG ENGINE_VERSION=26.1

FROM docker:${ENGINE_VERSION}-dind

diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py
index 2cd713ec8a..8727455932 100644
--- a/tests/integration/models_containers_test.py
+++ b/tests/integration/models_containers_test.py
@@ -131,10 +131,9 @@ def test_run_with_networking_config(self):
assert 'NetworkSettings' in attrs
assert 'Networks' in attrs['NetworkSettings']
assert list(attrs['NetworkSettings']['Networks'].keys()) == [net_name]
- # Expect Aliases to list 'test_alias' and the container's short-id.
- # In API version 1.45, the short-id will be removed.
+ # Aliases no longer include the container's short-id in API v1.45.
assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] \
- == [test_alias, attrs['Id'][:12]]
+ == [test_alias]
assert attrs['NetworkSettings']['Networks'][net_name]['DriverOpts'] \
== test_driver_opt

@@ -191,9 +190,9 @@ def test_run_with_networking_config_only_undeclared_network(self):
assert 'NetworkSettings' in attrs
assert 'Networks' in attrs['NetworkSettings']
assert list(attrs['NetworkSettings']['Networks'].keys()) == [net_name]
- # Aliases should include the container's short-id (but it will be removed
- # in API v1.45).
- assert attrs['NetworkSettings']['Networks'][net_name]['Aliases'] == [attrs["Id"][:12]]
+ # Aliases no longer include the container's short-id in API v1.45.
+ assert (attrs['NetworkSettings']['Networks'][net_name]['Aliases']
+ is None)
assert (attrs['NetworkSettings']['Networks'][net_name]['DriverOpts']
is None)

79 changes: 79 additions & 0 deletions data/containers/patches/docker-py/3290.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
From 96ef4d3bee53ed17bf62670837b51c73911d7455 Mon Sep 17 00:00:00 2001
From: Laura Brehm <[email protected]>
Date: Fri, 27 Sep 2024 13:36:48 +0100
Subject: [PATCH 1/2] tests/exec: expect 127 exit code for missing executable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Docker Engine has always returned `126` when starting an exec fails due
to a missing binary, but this was due to a bug in the daemon causing the
correct exit code to be overwritten in some cases – see: https://github.com/moby/moby/issues/45795

Change tests to expect correct exit code (`127`).

Signed-off-by: Laura Brehm <[email protected]>
---
tests/integration/models_containers_test.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py
index 476263ae23..c65f3d7f88 100644
--- a/tests/integration/models_containers_test.py
+++ b/tests/integration/models_containers_test.py
@@ -359,8 +359,11 @@ def test_exec_run_failed(self):
"alpine", "sh -c 'sleep 60'", detach=True
)
self.tmp_containers.append(container.id)
- exec_output = container.exec_run("docker ps")
- assert exec_output[0] == 126
+ exec_output = container.exec_run("non-existent")
+ # older versions of docker return `126` in the case that an exec cannot
+ # be started due to a missing executable. We're fixing this for the
+ # future, so accept both for now.
+ assert exec_output[0] == 127 or exec_output == 126

def test_kill(self):
client = docker.from_env(version=TEST_API_VERSION)

From b1265470e64c29d8b270e43387c5abb442e084c7 Mon Sep 17 00:00:00 2001
From: Laura Brehm <[email protected]>
Date: Fri, 27 Sep 2024 15:05:08 +0100
Subject: [PATCH 2/2] tests/exec: add test for exit code from exec

Execs should return the exit code of the exec'd process, if it started.

Signed-off-by: Laura Brehm <[email protected]>
---
tests/integration/models_containers_test.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py
index c65f3d7f88..2cd713ec8a 100644
--- a/tests/integration/models_containers_test.py
+++ b/tests/integration/models_containers_test.py
@@ -353,6 +353,15 @@ def test_exec_run_success(self):
assert exec_output[0] == 0
assert exec_output[1] == b"hello\n"

+ def test_exec_run_error_code_from_exec(self):
+ client = docker.from_env(version=TEST_API_VERSION)
+ container = client.containers.run(
+ "alpine", "sh -c 'sleep 20'", detach=True
+ )
+ self.tmp_containers.append(container.id)
+ exec_output = container.exec_run("sh -c 'exit 42'")
+ assert exec_output[0] == 42
+
def test_exec_run_failed(self):
client = docker.from_env(version=TEST_API_VERSION)
container = client.containers.run(
@@ -363,7 +372,7 @@ def test_exec_run_failed(self):
# older versions of docker return `126` in the case that an exec cannot
# be started due to a missing executable. We're fixing this for the
# future, so accept both for now.
- assert exec_output[0] == 127 or exec_output == 126
+ assert exec_output[0] == 127 or exec_output[0] == 126

def test_kill(self):
client = docker.from_env(version=TEST_API_VERSION)
42 changes: 42 additions & 0 deletions data/containers/patches/docker-py/3354.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From 6efb722c941af7daef1f4a7e4c9c670f61e90c9b Mon Sep 17 00:00:00 2001
From: Ricardo Branco <[email protected]>
Date: Wed, 20 Aug 2025 21:02:52 +0200
Subject: [PATCH] tests: Fix deprecation warning for utcfromtimestamp()

Fix DeprecationWarning for datetime.datetime.utcfromtimestamp()

It suggests to use timezone-aware objects to represent datetimes in UTC
with datetime.UTC but datetime.timezone.utc is backwards compatible.

Signed-off-by: Ricardo Branco <[email protected]>
---
tests/unit/api_container_test.py | 2 +-
tests/unit/api_test.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/unit/api_container_test.py b/tests/unit/api_container_test.py
index b2e5237a2a..1c4dda756a 100644
--- a/tests/unit/api_container_test.py
+++ b/tests/unit/api_container_test.py
@@ -1302,7 +1302,7 @@ def test_log_since_with_float(self):

def test_log_since_with_datetime(self):
ts = 809222400
- time = datetime.datetime.utcfromtimestamp(ts)
+ time = datetime.datetime.fromtimestamp(ts, datetime.timezone.utc)
with mock.patch('docker.api.client.APIClient.inspect_container',
fake_inspect_container):
self.client.logs(fake_api.FAKE_CONTAINER_ID, stream=False,
diff --git a/tests/unit/api_test.py b/tests/unit/api_test.py
index 3ce127b346..7e3e95178a 100644
--- a/tests/unit/api_test.py
+++ b/tests/unit/api_test.py
@@ -231,7 +231,7 @@ def test_events(self):

def test_events_with_since_until(self):
ts = 1356048000
- now = datetime.datetime.utcfromtimestamp(ts)
+ now = datetime.datetime.fromtimestamp(ts, datetime.timezone.utc)
since = now - datetime.timedelta(seconds=10)
until = now + datetime.timedelta(seconds=10)

25 changes: 25 additions & 0 deletions data/containers/patches/podman-py/572.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 74d880c4771ded8cda6dd69bb827688d56792e0b Mon Sep 17 00:00:00 2001
From: Ricardo Branco <[email protected]>
Date: Thu, 21 Aug 2025 21:28:09 +0200
Subject: [PATCH] tests: Fix tests to reflect removal of rw as default option

Behaviour changed upstream with https://github.com/containers/podman/pull/25942

Signed-off-by: Ricardo Branco <[email protected]>
---
podman/tests/integration/test_container_create.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/podman/tests/integration/test_container_create.py b/podman/tests/integration/test_container_create.py
index f098efbc..4e751163 100644
--- a/podman/tests/integration/test_container_create.py
+++ b/podman/tests/integration/test_container_create.py
@@ -316,7 +316,7 @@ def test_container_mounts(self):
self.containers.append(container)
self.assertEqual(
container.attrs.get('HostConfig', {}).get('Tmpfs', {}).get(mount['target']),
- f"size={mount['size']},rw,rprivate,nosuid,nodev,tmpcopyup",
+ f"size={mount['size']},rprivate,nosuid,nodev,tmpcopyup",
)

container.start()
39 changes: 39 additions & 0 deletions data/containers/patches/podman-py/575.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From a27a9d06a47cec4f684d7c16d14096f277d4fe30 Mon Sep 17 00:00:00 2001
From: Ricardo Branco <[email protected]>
Date: Sun, 24 Aug 2025 13:10:17 +0200
Subject: [PATCH] tests: Fix deprecation warning for utcfromtimestamp()

Fix DeprecationWarning for datetime.datetime.utcfromtimestamp()

It suggests to use timezone-aware objects to represent datetimes in UTC
with datetime.UTC but datetime.timezone.utc is backwards compatible.

Signed-off-by: Ricardo Branco <[email protected]>
---
podman/api/parse_utils.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/podman/api/parse_utils.py b/podman/api/parse_utils.py
index 39e30da7..0294712d 100644
--- a/podman/api/parse_utils.py
+++ b/podman/api/parse_utils.py
@@ -4,7 +4,7 @@
import ipaddress
import json
import struct
-from datetime import datetime
+from datetime import datetime, timezone
from typing import Any, Optional, Union
from collections.abc import Iterator

@@ -48,7 +48,9 @@ def prepare_timestamp(value: Union[datetime, int, None]) -> Optional[int]:
return value

if isinstance(value, datetime):
- delta = value - datetime.utcfromtimestamp(0)
+ if value.tzinfo is None:
+ value = value.replace(tzinfo=timezone.utc)
+ delta = value - datetime.fromtimestamp(0, timezone.utc)
return delta.seconds + delta.days * 24 * 3600

raise ValueError(f"Type '{type(value)}' is not supported by prepare_timestamp()")
6 changes: 6 additions & 0 deletions lib/main_containers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ sub load_host_tests_podman {
load_compose_tests($run_args);
loadtest('containers/seccomp', run_args => $run_args, name => $run_args->{runtime} . "_seccomp") unless is_sle('<15');
loadtest('containers/isolation', run_args => $run_args, name => $run_args->{runtime} . "_isolation") unless (is_public_cloud || is_transactional);
unless (is_jeos || is_staging || is_transactional || !is_tumbleweed || get_var("OCI_RUNTIME")) {
loadtest('containers/python_runtime', run_args => $run_args, name => "python_podman");
}
loadtest('containers/podmansh') if (is_tumbleweed && !is_staging && !is_transactional);
}

Expand Down Expand Up @@ -215,6 +218,9 @@ sub load_host_tests_docker {
# select_user_serial_terminal is broken on public cloud
loadtest 'containers/rootless_docker' unless (is_public_cloud);
}
unless (is_jeos || is_staging || is_transactional || !is_tumbleweed || check_var("CONTAINERS_DOCKER_FLAVOUR", "stable")) {
loadtest('containers/python_runtime', run_args => $run_args, name => "python_docker");
}
# Expected to work anywhere except of real HW backends, PC and Micro
unless (is_generalhw || is_ipmi || is_public_cloud || is_openstack || is_sle_micro || is_microos || is_leap_micro || (is_sle('=12-SP5') && is_aarch64)) {
loadtest 'containers/validate_btrfs';
Expand Down
Loading