test_python_isolation.py (1596:b7e2d4d92624) test_python_isolation.py (1622:773f29e26072)
1import pytest
2
3from unit.applications.lang.python import TestApplicationPython
4from unit.feature.isolation import TestFeatureIsolation
5
6
7class TestPythonIsolation(TestApplicationPython):
8 prerequisites = {'modules': {'python': 'any'}, 'features': ['isolation']}

--- 51 unchanged lines hidden (view full) ---

60 == False
61 ), 'no /sys/kernel'
62
63 ret = self.getjson(url='/?path=/app/python/ns_inspect')
64
65 assert (
66 ret['body']['FileExists'] == True
67 ), 'application exists in rootfs'
1import pytest
2
3from unit.applications.lang.python import TestApplicationPython
4from unit.feature.isolation import TestFeatureIsolation
5
6
7class TestPythonIsolation(TestApplicationPython):
8 prerequisites = {'modules': {'python': 'any'}, 'features': ['isolation']}

--- 51 unchanged lines hidden (view full) ---

60 == False
61 ), 'no /sys/kernel'
62
63 ret = self.getjson(url='/?path=/app/python/ns_inspect')
64
65 assert (
66 ret['body']['FileExists'] == True
67 ), 'application exists in rootfs'
68
69 def test_python_isolation_rootfs_no_language_deps(self, is_su):
70 isolation_features = self.available['features']['isolation'].keys()
71
72 if 'mnt' not in isolation_features:
73 pytest.skip('requires mnt ns')
74
75 if not is_su:
76 if 'user' not in isolation_features:
77 pytest.skip('requires unprivileged userns or root')
78
79 if not 'unprivileged_userns_clone' in isolation_features:
80 pytest.skip('requires unprivileged userns or root')
81
82 isolation = {
83 'namespaces': {'credential': not is_su, 'mount': True},
84 'rootfs': self.temp_dir,
85 'automount': {'language_deps': False}
86 }
87
88 self.load('empty', isolation=isolation)
89
90 assert (self.get()['status'] != 200), 'disabled language_deps'
91
92 isolation['automount']['language_deps'] = True
93
94 self.load('empty', isolation=isolation)
95
96 assert (self.get()['status'] == 200), 'enabled language_deps'
97