summaryrefslogtreecommitdiffhomepage
path: root/test/test_go_isolation.py
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2020-11-16 17:22:10 +0000
committerTiago Natel de Moura <t.nateldemoura@f5.com>2020-11-16 17:22:10 +0000
commitbbc29df8fe4400e881829741c969f2fb77487423 (patch)
tree713195a9db5ebf4228e03eb5a344f62af35fb94d /test/test_go_isolation.py
parent567f0a7b3049f4532524ac35cb232cbeedb868bf (diff)
downloadunit-bbc29df8fe4400e881829741c969f2fb77487423.tar.gz
unit-bbc29df8fe4400e881829741c969f2fb77487423.tar.bz2
Tests: tmpfs automount.
Diffstat (limited to 'test/test_go_isolation.py')
-rw-r--r--test/test_go_isolation.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/test/test_go_isolation.py b/test/test_go_isolation.py
index e3a0a210..8c4a6b9c 100644
--- a/test/test_go_isolation.py
+++ b/test/test_go_isolation.py
@@ -332,7 +332,12 @@ class TestGoIsolation(TestApplicationGo):
obj = self.getjson(url='/?file=/bin/sh')['body']
assert obj['FileExists'] == False, 'file should not exists'
- def test_go_isolation_rootfs_default_tmpfs(self, is_su, temp_dir):
+ def test_go_isolation_rootfs_automount_tmpfs(self, is_su, temp_dir):
+ try:
+ open("/proc/self/mountinfo")
+ except:
+ pytest.skip('The system lacks /proc/self/mountinfo file')
+
if not is_su:
if not self.isolation_key('unprivileged_userns_clone'):
pytest.skip('unprivileged clone is not available')
@@ -357,6 +362,20 @@ class TestGoIsolation(TestApplicationGo):
self.load('ns_inspect', isolation=isolation)
- obj = self.getjson(url='/?file=/tmp')['body']
+ obj = self.getjson(url='/?mounts=true')['body']
+
+ assert (
+ "/ /tmp" in obj['Mounts'] and "tmpfs" in obj['Mounts']
+ ), 'app has /tmp mounted on /'
+
+ isolation['automount'] = {
+ 'tmpfs': False
+ }
+
+ self.load('ns_inspect', isolation=isolation)
+
+ obj = self.getjson(url='/?mounts=true')['body']
- assert obj['FileExists'] == True, 'app has /tmp'
+ assert (
+ "/ /tmp" not in obj['Mounts'] and "tmpfs" not in obj['Mounts']
+ ), 'app has no /tmp mounted'