Debian Codegraph @

tests/integration/uidmaps/test_podman_compose_uidmaps.py

raw symbols SCIP
1 # SPDX-License-Identifier: GPL-2.0
2
3 import json
4 import os
5 import unittest
6
7 from tests.integration.test_utils import RunSubprocessMixin
8 from tests.integration.test_utils import podman_compose_path
9 from tests.integration.test_utils import test_path
10
11
12 class TestPodmanCompose(unittest.TestCase, RunSubprocessMixin):
13 def test_uidmaps(self) -> None:
14 compose_path = os.path.join(test_path(), "uidmaps", "docker-compose.yml")
15 try:
16 self.run_subprocess_assert_returncode([
17 podman_compose_path(),
18 "-f",
19 compose_path,
20 "up",
21 "-d",
22 ])
23
24 out, _ = self.run_subprocess_assert_returncode([
25 "podman",
26 "inspect",
27 "uidmaps_touch_1",
28 ])
29
30 inspect_out = json.loads(out)
31 host_config_map = inspect_out[0].get("HostConfig", {}).get("IDMappings", {})
32 self.assertEqual(['0:1:1', '999:0:1'], host_config_map['UidMap'])
33 self.assertEqual(['0:1:1', '999:0:1'], host_config_map['GidMap'])
34 finally:
35 out, _ = self.run_subprocess_assert_returncode([
36 podman_compose_path(),
37 "-f",
38 compose_path,
39 "down",
40 ])