PHP: fixed "rootfs" isolation dependency on system mounts.
This commit is contained in:
@@ -85,54 +85,3 @@ class TestPHPIsolation(TestApplicationPHP):
|
||||
|
||||
assert 'json' in extensions, 'json in extensions list'
|
||||
assert 'unit' in extensions, 'unit in extensions list'
|
||||
|
||||
def test_php_isolation_rootfs_no_language_libs(self, is_su):
|
||||
isolation_features = self.available['features']['isolation'].keys()
|
||||
|
||||
if not is_su:
|
||||
if 'user' not in isolation_features:
|
||||
pytest.skip('requires unprivileged userns or root')
|
||||
|
||||
if not 'unprivileged_userns_clone' in isolation_features:
|
||||
pytest.skip('requires unprivileged userns or root')
|
||||
|
||||
if 'mnt' not in isolation_features:
|
||||
pytest.skip('requires mnt ns')
|
||||
|
||||
isolation = {
|
||||
'rootfs': option.test_dir,
|
||||
'automount': {'language_deps': False},
|
||||
'namespaces': {'credential': not is_su, 'mount': not is_su},
|
||||
}
|
||||
|
||||
self.load('list-extensions', isolation=isolation)
|
||||
|
||||
assert 'success' in self.conf(
|
||||
'"/php/list-extensions"', 'applications/list-extensions/root'
|
||||
)
|
||||
|
||||
assert 'success' in self.conf(
|
||||
{'file': '/php/list-extensions/php.ini'},
|
||||
'applications/list-extensions/options',
|
||||
)
|
||||
|
||||
assert 'success' in self.conf(
|
||||
'"/php/list-extensions"',
|
||||
'applications/list-extensions/working_directory',
|
||||
)
|
||||
|
||||
extensions = self.getjson()['body']
|
||||
|
||||
assert 'unit' in extensions, 'unit in extensions list'
|
||||
assert 'json' not in extensions, 'json not in extensions list'
|
||||
|
||||
assert 'success' in self.conf(
|
||||
{'language_deps': True},
|
||||
'applications/list-extensions/isolation/automount',
|
||||
)
|
||||
|
||||
extensions = self.getjson()['body']
|
||||
|
||||
assert 'unit' in extensions, 'unit in extensions list 2'
|
||||
assert 'json' in extensions, 'json in extensions list 2'
|
||||
|
||||
|
||||
@@ -65,3 +65,33 @@ class TestPythonIsolation(TestApplicationPython):
|
||||
assert (
|
||||
ret['body']['FileExists'] == True
|
||||
), 'application exists in rootfs'
|
||||
|
||||
def test_python_isolation_rootfs_no_language_deps(self, is_su):
|
||||
isolation_features = self.available['features']['isolation'].keys()
|
||||
|
||||
if 'mnt' not in isolation_features:
|
||||
pytest.skip('requires mnt ns')
|
||||
|
||||
if not is_su:
|
||||
if 'user' not in isolation_features:
|
||||
pytest.skip('requires unprivileged userns or root')
|
||||
|
||||
if not 'unprivileged_userns_clone' in isolation_features:
|
||||
pytest.skip('requires unprivileged userns or root')
|
||||
|
||||
isolation = {
|
||||
'namespaces': {'credential': not is_su, 'mount': True},
|
||||
'rootfs': self.temp_dir,
|
||||
'automount': {'language_deps': False}
|
||||
}
|
||||
|
||||
self.load('empty', isolation=isolation)
|
||||
|
||||
assert (self.get()['status'] != 200), 'disabled language_deps'
|
||||
|
||||
isolation['automount']['language_deps'] = True
|
||||
|
||||
self.load('empty', isolation=isolation)
|
||||
|
||||
assert (self.get()['status'] == 200), 'enabled language_deps'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user