summaryrefslogtreecommitdiffhomepage
path: root/test/test_go_isolation.py
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2019-11-14 19:29:00 +0300
committerAndrei Belov <defan@nginx.com>2019-11-14 19:29:00 +0300
commit7630539c44fcb188bba03a65af34e952a81f2f38 (patch)
tree2c80f0cd315cae8079a39ba98ed89e02b5e1931a /test/test_go_isolation.py
parent70c9f18b6e8b25850bce8eb1edba4d100c3e55d2 (diff)
parent0a27f137de776925a24406cf6961c550824c63a0 (diff)
downloadunit-1.13.0-1.tar.gz
unit-1.13.0-1.tar.bz2
Merged with the default branch.1.13.0-1
Diffstat (limited to '')
-rw-r--r--test/test_go_isolation.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test_go_isolation.py b/test/test_go_isolation.py
index 780c2b03..ee5ddf47 100644
--- a/test/test_go_isolation.py
+++ b/test/test_go_isolation.py
@@ -130,6 +130,38 @@ class TestGoIsolation(TestApplicationGo):
self.assertEqual(obj['PID'], 1, 'pid of container is 1')
+ def test_isolation_namespace_false(self):
+ self.load('ns_inspect')
+ allns = list(self.available['features']['isolation'].keys())
+
+ remove_list = ['unprivileged_userns_clone', 'ipc', 'cgroup']
+ allns = [ns for ns in allns if ns not in remove_list]
+
+ namespaces = {}
+ for ns in allns:
+ if ns == 'user':
+ namespaces['credential'] = False
+ elif ns == 'mnt':
+ namespaces['mount'] = False
+ elif ns == 'net':
+ namespaces['network'] = False
+ elif ns == 'uts':
+ namespaces['uname'] = False
+ else:
+ namespaces[ns] = False
+
+ self.conf_isolation({"namespaces": namespaces})
+
+ obj = self.isolation.parsejson(self.get()['body'])
+
+ for ns in allns:
+ if ns.upper() in obj['NS']:
+ self.assertEqual(
+ obj['NS'][ns.upper()],
+ self.available['features']['isolation'][ns],
+ '%s match' % ns,
+ )
+
if __name__ == '__main__':
TestGoIsolation.main()