Add tests for x-podman.uidmaps and x-podman.gidmaps

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas 2024-04-28 18:23:20 +03:00
parent 9599cc039e
commit a6c4263738

View File

@ -171,6 +171,50 @@ class TestContainerToArgs(unittest.IsolatedAsyncioTestCase):
with self.assertRaises(ValueError):
await container_to_args(c, cnt)
async def test_uidmaps_extension(self):
c = create_compose_mock()
cnt = get_minimal_container()
cnt['x-podman.uidmaps'] = ['1000:1000:1', '1001:1001:2']
args = await container_to_args(c, cnt)
self.assertEqual(
args,
[
"--name=project_name_service_name1",
"-d",
"--network=bridge",
"--network-alias=service_name",
'--uidmap',
'1000:1000:1',
'--uidmap',
'1001:1001:2',
"busybox",
],
)
async def test_gidmaps_extension(self):
c = create_compose_mock()
cnt = get_minimal_container()
cnt['x-podman.gidmaps'] = ['1000:1000:1', '1001:1001:2']
args = await container_to_args(c, cnt)
self.assertEqual(
args,
[
"--name=project_name_service_name1",
"-d",
"--network=bridge",
"--network-alias=service_name",
'--gidmap',
'1000:1000:1',
'--gidmap',
'1001:1001:2',
"busybox",
],
)
async def test_rootfs_extension(self):
c = create_compose_mock()