test_ruby_isolation.py (1672:1b93d4f6fc0a) test_ruby_isolation.py (1673:883f2f79c2f6)
1import shutil
2
3import pytest
4
5from conftest import option
6from conftest import unit_run
7from conftest import unit_stop
8from unit.applications.lang.ruby import TestApplicationRuby

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

24 assert unit_stop() is None
25 shutil.rmtree(unit['temp_dir'])
26
27 return check if not complete_check else check()
28
29 def test_ruby_isolation_rootfs_mount_namespace(self, is_su):
30 isolation_features = option.available['features']['isolation'].keys()
31
1import shutil
2
3import pytest
4
5from conftest import option
6from conftest import unit_run
7from conftest import unit_stop
8from unit.applications.lang.ruby import TestApplicationRuby

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

24 assert unit_stop() is None
25 shutil.rmtree(unit['temp_dir'])
26
27 return check if not complete_check else check()
28
29 def test_ruby_isolation_rootfs_mount_namespace(self, is_su):
30 isolation_features = option.available['features']['isolation'].keys()
31
32 if 'mnt' not in isolation_features:
33 pytest.skip('requires mnt ns')
34
35 if not is_su:
32 if not is_su:
36 if 'user' not in isolation_features:
37 pytest.skip('requires unprivileged userns or root')
38
39 if not 'unprivileged_userns_clone' in isolation_features:
40 pytest.skip('requires unprivileged userns or root')
41
33 if not 'unprivileged_userns_clone' in isolation_features:
34 pytest.skip('requires unprivileged userns or root')
35
42 isolation = {
43 'namespaces': {'credential': not is_su, 'mount': True},
44 'rootfs': option.test_dir,
45 }
36 if 'user' not in isolation_features:
37 pytest.skip('user namespace is not supported')
46
38
39 if 'mnt' not in isolation_features:
40 pytest.skip('mnt namespace is not supported')
41
42 if 'pid' not in isolation_features:
43 pytest.skip('pid namespace is not supported')
44
45 isolation = {'rootfs': option.test_dir}
46
47 if not is_su:
48 isolation['namespaces'] = {
49 'mount': True,
50 'credential': True,
51 'pid': True
52 }
53
47 self.load('status_int', isolation=isolation)
48
49 assert 'success' in self.conf(
50 '"/ruby/status_int/config.ru"', 'applications/status_int/script',
51 )
52
53 assert 'success' in self.conf(
54 '"/ruby/status_int"', 'applications/status_int/working_directory',

--- 22 unchanged lines hidden ---
54 self.load('status_int', isolation=isolation)
55
56 assert 'success' in self.conf(
57 '"/ruby/status_int/config.ru"', 'applications/status_int/script',
58 )
59
60 assert 'success' in self.conf(
61 '"/ruby/status_int"', 'applications/status_int/working_directory',

--- 22 unchanged lines hidden ---