diff options
| author | Konstantin Pavlov <thresh@nginx.com> | 2023-08-31 09:41:46 -0700 |
|---|---|---|
| committer | Konstantin Pavlov <thresh@nginx.com> | 2023-08-31 09:41:46 -0700 |
| commit | c45c8919c7232eb20023484f6d1fc9f1f50395d8 (patch) | |
| tree | cc12eb307c1611494948645e4b487fa06495c3d2 /test/test_go_isolation_rootfs.py | |
| parent | 88c90e1c351ab8c5bd487a5cd4b735014b08e271 (diff) | |
| parent | 9b22b6957bc87b3df002d0bc691fdae6a20abdac (diff) | |
| download | unit-1.31.0-1.tar.gz unit-1.31.0-1.tar.bz2 | |
Merged with the default branch.1.31.0-1
Diffstat (limited to '')
| -rw-r--r-- | test/test_go_isolation_rootfs.py | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/test/test_go_isolation_rootfs.py b/test/test_go_isolation_rootfs.py index d246a48d..b627b515 100644 --- a/test/test_go_isolation_rootfs.py +++ b/test/test_go_isolation_rootfs.py @@ -1,32 +1,19 @@ -import os +from unit.applications.lang.go import ApplicationGo -import pytest -from unit.applications.lang.go import TestApplicationGo +prerequisites = { + 'modules': {'go': 'all'}, + 'features': {'isolation': True}, + 'privileged_user': True, +} +client = ApplicationGo() -class TestGoIsolationRootfs(TestApplicationGo): - prerequisites = {'modules': {'go': 'all'}} - @pytest.fixture(autouse=True) - def setup_method_fixture(self, request, skip_alert): - skip_alert(r'\[unit\] close\(\d+\) failed: Bad file descriptor') +def test_go_isolation_rootfs_chroot(temp_dir): + client.load('ns_inspect', isolation={'rootfs': temp_dir}) - def test_go_isolation_rootfs_chroot(self, is_su, temp_dir): - if not is_su: - pytest.skip('requires root') + obj = client.getjson(url='/?file=/go/app')['body'] + assert obj['FileExists'], 'app relative to rootfs' - if os.uname().sysname == 'Darwin': - pytest.skip('chroot tests not supported on OSX') - - isolation = { - 'rootfs': temp_dir, - } - - self.load('ns_inspect', isolation=isolation) - - obj = self.getjson(url='/?file=/go/app')['body'] - - assert obj['FileExists'] == True, 'app relative to rootfs' - - obj = self.getjson(url='/?file=/bin/sh')['body'] - assert obj['FileExists'] == False, 'file should not exists' + obj = client.getjson(url='/?file=/bin/sh')['body'] + assert not obj['FileExists'], 'file should not exists' |
