test_php_isolation.py (1596:b7e2d4d92624) test_php_isolation.py (1622:773f29e26072)
1import pytest
2
3from unit.applications.lang.php import TestApplicationPHP
4from unit.feature.isolation import TestFeatureIsolation
5from conftest import option
6
7
8class TestPHPIsolation(TestApplicationPHP):

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

80 '"/php/list-extensions"',
81 'applications/list-extensions/working_directory',
82 )
83
84 extensions = self.getjson()['body']
85
86 assert 'json' in extensions, 'json in extensions list'
87 assert 'unit' in extensions, 'unit in extensions list'
1import pytest
2
3from unit.applications.lang.php import TestApplicationPHP
4from unit.feature.isolation import TestFeatureIsolation
5from conftest import option
6
7
8class TestPHPIsolation(TestApplicationPHP):

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

80 '"/php/list-extensions"',
81 'applications/list-extensions/working_directory',
82 )
83
84 extensions = self.getjson()['body']
85
86 assert 'json' in extensions, 'json in extensions list'
87 assert 'unit' in extensions, 'unit in extensions list'
88
89 def test_php_isolation_rootfs_no_language_libs(self, is_su):
90 isolation_features = self.available['features']['isolation'].keys()
91
92 if not is_su:
93 if 'user' not in isolation_features:
94 pytest.skip('requires unprivileged userns or root')
95
96 if not 'unprivileged_userns_clone' in isolation_features:
97 pytest.skip('requires unprivileged userns or root')
98
99 if 'mnt' not in isolation_features:
100 pytest.skip('requires mnt ns')
101
102 isolation = {
103 'rootfs': option.test_dir,
104 'automount': {'language_deps': False},
105 'namespaces': {'credential': not is_su, 'mount': not is_su},
106 }
107
108 self.load('list-extensions', isolation=isolation)
109
110 assert 'success' in self.conf(
111 '"/php/list-extensions"', 'applications/list-extensions/root'
112 )
113
114 assert 'success' in self.conf(
115 {'file': '/php/list-extensions/php.ini'},
116 'applications/list-extensions/options',
117 )
118
119 assert 'success' in self.conf(
120 '"/php/list-extensions"',
121 'applications/list-extensions/working_directory',
122 )
123
124 extensions = self.getjson()['body']
125
126 assert 'unit' in extensions, 'unit in extensions list'
127 assert 'json' not in extensions, 'json not in extensions list'
128
129 assert 'success' in self.conf(
130 {'language_deps': True},
131 'applications/list-extensions/isolation/automount',
132 )
133
134 extensions = self.getjson()['body']
135
136 assert 'unit' in extensions, 'unit in extensions list 2'
137 assert 'json' in extensions, 'json in extensions list 2'
138