Debian Codegraph @

tests/integration/seccomp/test_podman_compose_seccomp.py

raw symbols SCIP
1 # SPDX-License-Identifier: GPL-2.0
2
3 import os
4 import unittest
5
6 from tests.integration.test_utils import RunSubprocessMixin
7 from tests.integration.test_utils import podman_compose_path
8 from tests.integration.test_utils import test_path
9
10
11 def compose_yaml_path() -> str:
12 return os.path.join(os.path.join(test_path(), "seccomp"), "docker-compose.yml")
13
14
15 class TestComposeSeccomp(unittest.TestCase, RunSubprocessMixin):
16 @unittest.skip(
17 "Skip till security_opt seccomp from 'docker-compose.yml' will be able to accept a "
18 "relative path of 'default.json' file. Now test works as expected but only with the "
19 "absolute path."
20 )
21 # test if seccomp uses custom seccomp profile file 'default.json' where command mkdir is not
22 # allowed
23 def test_seccomp(self) -> None:
24 try:
25 output, _, return_code = self.run_subprocess(
26 [podman_compose_path(), "-f", compose_yaml_path(), "run", "--rm", "web1"],
27 )
28 self.assertEqual(return_code, 1)
29 self.assertIn(
30 b"mkdir: can't create directory '/tmp_test': Operation not permitted", output
31 )
32 finally:
33 self.run_subprocess_assert_returncode([
34 podman_compose_path(),
35 "-f",
36 compose_yaml_path(),
37 "down",
38 "-t",
39 "0",
40 ])