summaryrefslogtreecommitdiffhomepage
path: root/test/test_php_isolation.py
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2020-08-25 13:48:33 +0100
committerTiago Natel de Moura <t.nateldemoura@f5.com>2020-08-25 13:48:33 +0100
commit244ffb2829cfbac26e013988474184d6050504fe (patch)
treeaa6376887214453f539f6c19802d1d07d830fca5 /test/test_php_isolation.py
parent30a242aa3cbfc3c3368ba0b6d2b4e579b31dc553 (diff)
downloadunit-244ffb2829cfbac26e013988474184d6050504fe.tar.gz
unit-244ffb2829cfbac26e013988474184d6050504fe.tar.bz2
Tests: PHP extension mounts.
Diffstat (limited to 'test/test_php_isolation.py')
-rw-r--r--test/test_php_isolation.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/test_php_isolation.py b/test/test_php_isolation.py
index 1b70ef02..abaf70a2 100644
--- a/test/test_php_isolation.py
+++ b/test/test_php_isolation.py
@@ -52,6 +52,60 @@ class TestPHPIsolation(TestApplicationPHP):
self.assertEqual(self.get()['status'], 200, 'empty rootfs')
+ def test_php_isolation_rootfs_extensions(self):
+ isolation_features = self.available['features']['isolation'].keys()
+
+ if not self.is_su:
+ if 'user' not in isolation_features:
+ print('requires unprivileged userns or root')
+ raise unittest.SkipTest()
+
+ if not 'unprivileged_userns_clone' in isolation_features:
+ print('requires unprivileged userns or root')
+ raise unittest.SkipTest()
+
+ if 'mnt' not in isolation_features:
+ print('requires mnt ns')
+ raise unittest.SkipTest()
+
+ isolation = {
+ 'rootfs': self.current_dir,
+ 'namespaces': {
+ 'credential': not self.is_su,
+ 'mount': not self.is_su,
+ },
+ }
+
+ self.load('list-extensions', isolation=isolation)
+
+ self.assertIn(
+ 'success',
+ self.conf(
+ '"/php/list-extensions"', 'applications/list-extensions/root'
+ ),
+ )
+
+ self.assertIn(
+ 'success',
+ self.conf(
+ {'file': '/php/list-extensions/php.ini'},
+ 'applications/list-extensions/options',
+ ),
+ )
+
+ self.assertIn(
+ 'success',
+ self.conf(
+ '"/php/list-extensions"',
+ 'applications/list-extensions/working_directory',
+ ),
+ )
+
+ extensions = self.getjson()['body']
+
+ self.assertIn('json', extensions, 'json in extensions list')
+ self.assertIn('unit', extensions, 'unit in extensions list')
+
if __name__ == '__main__':
TestPHPIsolation.main()