diff options
author | Tiago Natel <t.nateldemoura@f5.com> | 2019-10-11 10:00:06 +0000 |
---|---|---|
committer | Tiago Natel <t.nateldemoura@f5.com> | 2019-10-11 10:00:06 +0000 |
commit | 0beb8ea5e13befbe607a107c3e8093226848811a (patch) | |
tree | 57d3134a7c3027bc5304365e295192911e220a5f /test/test_go_isolation.py | |
parent | 09e7357b085aab4f29bdadceee112bd7a8ccf706 (diff) | |
download | unit-0beb8ea5e13befbe607a107c3e8093226848811a.tar.gz unit-0beb8ea5e13befbe607a107c3e8093226848811a.tar.bz2 |
Fixed passing false in namespace flags.
This patch closes #328 in github.
Diffstat (limited to 'test/test_go_isolation.py')
-rw-r--r-- | test/test_go_isolation.py | 32 |
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() |