summaryrefslogtreecommitdiffhomepage
path: root/test/test_ruby_isolation.py
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2020-12-08 16:38:41 +0000
committerTiago Natel de Moura <t.nateldemoura@f5.com>2020-12-08 16:38:41 +0000
commitc7bd96b4769abb11a92a081061bc83171d5ed6ac (patch)
treead047d9d8b1a4296557f7a13aae92c50859655b7 /test/test_ruby_isolation.py
parentb2e767819f04153944d525ef8d97d2f3a7a9af74 (diff)
downloadunit-c7bd96b4769abb11a92a081061bc83171d5ed6ac.tar.gz
unit-c7bd96b4769abb11a92a081061bc83171d5ed6ac.tar.bz2
Tests: fixed ruby isolation.
While alternating between running priv and unpriv tests locally, it happens that unpriv tests can't bind mount or create sub directories inside directories created by root. This patch fixes this by pointing "rootfs" to temporary directory. Now the priv and unpriv test uses the same test function.
Diffstat (limited to '')
-rw-r--r--test/test_ruby_isolation.py27
1 files changed, 8 insertions, 19 deletions
diff --git a/test/test_ruby_isolation.py b/test/test_ruby_isolation.py
index 56fccbd0..8c382e5a 100644
--- a/test/test_ruby_isolation.py
+++ b/test/test_ruby_isolation.py
@@ -1,5 +1,6 @@
import shutil
+import os
import pytest
from conftest import unit_run
@@ -26,7 +27,7 @@ class TestRubyIsolation(TestApplicationRuby):
return check if not complete_check else check()
- def test_ruby_isolation_rootfs_mount_namespace(self, is_su):
+ def test_ruby_isolation_rootfs(self, is_su):
isolation_features = option.available['features']['isolation'].keys()
if not is_su:
@@ -42,34 +43,22 @@ class TestRubyIsolation(TestApplicationRuby):
if 'pid' not in isolation_features:
pytest.skip('pid namespace is not supported')
- isolation = {'rootfs': option.test_dir}
+ isolation = {'rootfs': option.temp_dir}
if not is_su:
isolation['namespaces'] = {
'mount': True,
'credential': True,
- 'pid': True
+ 'pid': True,
}
- self.load('status_int', isolation=isolation)
+ os.mkdir(option.temp_dir + '/ruby')
- assert 'success' in self.conf(
- '"/ruby/status_int/config.ru"', 'applications/status_int/script',
- )
-
- assert 'success' in self.conf(
- '"/ruby/status_int"', 'applications/status_int/working_directory',
+ shutil.copytree(
+ option.test_dir + '/ruby/status_int',
+ option.temp_dir + '/ruby/status_int',
)
- assert self.get()['status'] == 200, 'status int'
-
- def test_ruby_isolation_rootfs(self, is_su):
- if not is_su:
- pytest.skip('requires root')
- return
-
- isolation = {'rootfs': option.test_dir}
-
self.load('status_int', isolation=isolation)
assert 'success' in self.conf(