Skip to content

Commit c8c27a8

Browse files
committed
Added test uppercase mount option attributes
1 parent 5085853 commit c8c27a8

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

podman/domain/containers_create.py

+1
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ def to_bytes(size: Union[int, str, None]) -> Union[int, None]:
571571
regular_options = ["consistency", "mode", "size"]
572572

573573
for k, v in item.items():
574+
k = k.lower()
574575
option_name = names_dict.get(k, k)
575576
if k in bool_options and v is True:
576577
options.append(option_name)

podman/tests/integration/test_container_create.py

+23
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,29 @@ def test_container_mounts(self):
288288
)
289289
)
290290

291+
with self.subTest("Check uppercase mount option attributes"):
292+
mount = {
293+
"TypE": "bind",
294+
"SouRce": "/etc/hosts",
295+
"TarGet": "/test",
296+
"Read_Only": True,
297+
"ReLabel": "Z",
298+
}
299+
container = self.client.containers.create(
300+
self.alpine_image, command=["cat", "/test"], mounts=[mount]
301+
)
302+
self.containers.append(container)
303+
self.assertIn(
304+
f"{mount['SouRce']}:{mount['TarGet']}:ro,Z,rprivate,rbind",
305+
container.attrs.get('HostConfig', {}).get('Binds', list()),
306+
)
307+
308+
# check if container can be started and exits with EC == 0
309+
container.start()
310+
container.wait()
311+
312+
self.assertEqual(container.attrs.get('State', dict()).get('ExitCode', 256), 0)
313+
291314
def test_container_devices(self):
292315
devices = ["/dev/null:/dev/foo", "/dev/zero:/dev/bar"]
293316
container = self.client.containers.create(

0 commit comments

Comments
 (0)