Skip to content

Commit

Permalink
Added test uppercase mount option attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
D3vil0p3r committed Jan 7, 2025
1 parent 5085853 commit c8c27a8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions podman/domain/containers_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ def to_bytes(size: Union[int, str, None]) -> Union[int, None]:
regular_options = ["consistency", "mode", "size"]

for k, v in item.items():
k = k.lower()
option_name = names_dict.get(k, k)
if k in bool_options and v is True:
options.append(option_name)
Expand Down
23 changes: 23 additions & 0 deletions podman/tests/integration/test_container_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,29 @@ def test_container_mounts(self):
)
)

with self.subTest("Check uppercase mount option attributes"):
mount = {
"TypE": "bind",
"SouRce": "/etc/hosts",
"TarGet": "/test",
"Read_Only": True,
"ReLabel": "Z",
}
container = self.client.containers.create(
self.alpine_image, command=["cat", "/test"], mounts=[mount]
)
self.containers.append(container)
self.assertIn(
f"{mount['SouRce']}:{mount['TarGet']}:ro,Z,rprivate,rbind",
container.attrs.get('HostConfig', {}).get('Binds', list()),
)

# check if container can be started and exits with EC == 0
container.start()
container.wait()

self.assertEqual(container.attrs.get('State', dict()).get('ExitCode', 256), 0)

def test_container_devices(self):
devices = ["/dev/null:/dev/foo", "/dev/zero:/dev/bar"]
container = self.client.containers.create(
Expand Down

0 comments on commit c8c27a8

Please sign in to comment.