test_go_isolation.py (1490:cecf6b11a1e3) test_go_isolation.py (1581:a1a83bef4471)
1import grp
2import pwd
3import unittest
4
5from unit.applications.lang.go import TestApplicationGo
6from unit.feature.isolation import TestFeatureIsolation
7
8

--- 313 unchanged lines hidden (view full) ---

322
323 obj = self.getjson(url='/?file=/go/app')['body']
324
325 self.assertEqual(obj['FileExists'], True, 'app relative to rootfs')
326
327 obj = self.getjson(url='/?file=/bin/sh')['body']
328 self.assertEqual(obj['FileExists'], False, 'file should not exists')
329
1import grp
2import pwd
3import unittest
4
5from unit.applications.lang.go import TestApplicationGo
6from unit.feature.isolation import TestFeatureIsolation
7
8

--- 313 unchanged lines hidden (view full) ---

322
323 obj = self.getjson(url='/?file=/go/app')['body']
324
325 self.assertEqual(obj['FileExists'], True, 'app relative to rootfs')
326
327 obj = self.getjson(url='/?file=/bin/sh')['body']
328 self.assertEqual(obj['FileExists'], False, 'file should not exists')
329
330 def test_go_isolation_rootfs_default_tmpfs(self):
331 if not self.isolation_key('unprivileged_userns_clone'):
332 print('unprivileged clone is not available')
333 raise unittest.SkipTest()
330
334
335 if not self.isolation_key('mnt'):
336 print('mnt namespace is not supported')
337 raise unittest.SkipTest()
338
339 isolation = {
340 'namespaces': {'mount': True, 'credential': True},
341 'rootfs': self.testdir,
342 }
343
344 self.load('ns_inspect', isolation=isolation)
345
346 obj = self.getjson(url='/?file=/tmp')['body']
347
348 self.assertEqual(obj['FileExists'], True, 'app has /tmp')
349
350
331if __name__ == '__main__':
332 TestGoIsolation.main()
351if __name__ == '__main__':
352 TestGoIsolation.main()