diff options
author | Max Romanov <max.romanov@nginx.com> | 2021-11-09 15:48:44 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2021-11-09 15:48:44 +0300 |
commit | 506ec2b8258cfe03d0d7e3b19eb79d1075a6174c (patch) | |
tree | ec619b5e7d8ce86903922593ff43e63d1a2f1264 | |
parent | e207415a78ae67b937faf7e5bcd6e5192993180a (diff) | |
download | unit-506ec2b8258cfe03d0d7e3b19eb79d1075a6174c.tar.gz unit-506ec2b8258cfe03d0d7e3b19eb79d1075a6174c.tar.bz2 |
Tests: app prototype related fixes.
-rw-r--r-- | test/test_go_application.py | 6 | ||||
-rw-r--r-- | test/test_go_isolation.py | 6 | ||||
-rw-r--r-- | test/test_go_isolation_rootfs.py | 4 | ||||
-rw-r--r-- | test/test_python_procman.py | 4 | ||||
-rw-r--r-- | test/test_tls.py | 2 |
5 files changed, 19 insertions, 3 deletions
diff --git a/test/test_go_application.py b/test/test_go_application.py index 438ce2e0..94da1aee 100644 --- a/test/test_go_application.py +++ b/test/test_go_application.py @@ -1,11 +1,17 @@ import re +import pytest + from unit.applications.lang.go import TestApplicationGo class TestGoApplication(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_application_variables(self): self.load('variables') diff --git a/test/test_go_isolation.py b/test/test_go_isolation.py index 0530dfdf..72988a34 100644 --- a/test/test_go_isolation.py +++ b/test/test_go_isolation.py @@ -11,6 +11,10 @@ from unit.utils import getns class TestGoIsolation(TestApplicationGo): prerequisites = {'modules': {'go': 'any'}, 'features': ['isolation']} + @pytest.fixture(autouse=True) + def setup_method_fixture(self, request, skip_alert): + skip_alert(r'\[unit\] close\(\d+\) failed: Bad file descriptor') + def unpriv_creds(self): nobody_uid = pwd.getpwnam('nobody').pw_uid @@ -227,7 +231,7 @@ class TestGoIsolation(TestApplicationGo): obj = self.getjson()['body'] - assert obj['PID'] == 1, 'pid of container is 1' + assert obj['PID'] == 2, 'pid of container is 2' def test_isolation_namespace_false(self): self.load('ns_inspect') diff --git a/test/test_go_isolation_rootfs.py b/test/test_go_isolation_rootfs.py index 2bded5ec..d246a48d 100644 --- a/test/test_go_isolation_rootfs.py +++ b/test/test_go_isolation_rootfs.py @@ -7,6 +7,10 @@ from unit.applications.lang.go import TestApplicationGo 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(self, is_su, temp_dir): if not is_su: pytest.skip('requires root') diff --git a/test/test_python_procman.py b/test/test_python_procman.py index 389d0747..a25b84ec 100644 --- a/test/test_python_procman.py +++ b/test/test_python_procman.py @@ -22,7 +22,9 @@ class TestPythonProcman(TestApplicationPython): output = subprocess.check_output(['ps', 'ax']) pids = set() - for m in re.findall('.*' + self.app_name, output.decode()): + for m in re.findall( + '.*unit: "' + self.app_name + '" application', output.decode() + ): pids.add(re.search(r'^\s*(\d+)', m).group(1)) return pids diff --git a/test/test_tls.py b/test/test_tls.py index a91a3760..d2d71141 100644 --- a/test/test_tls.py +++ b/test/test_tls.py @@ -591,7 +591,7 @@ basicConstraints = critical,CA:TRUE""" subprocess.call(['kill', '-9', app_id]) - skip_alert(r'process %s exited on signal 9' % app_id) + skip_alert(r'process .* %s.* exited on signal 9' % app_id) self.wait_for_record( re.compile( |