Tests: app prototype related fixes.
This commit is contained in:
@@ -1,11 +1,17 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
from unit.applications.lang.go import TestApplicationGo
|
from unit.applications.lang.go import TestApplicationGo
|
||||||
|
|
||||||
|
|
||||||
class TestGoApplication(TestApplicationGo):
|
class TestGoApplication(TestApplicationGo):
|
||||||
prerequisites = {'modules': {'go': 'all'}}
|
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):
|
def test_go_application_variables(self):
|
||||||
self.load('variables')
|
self.load('variables')
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ from unit.utils import getns
|
|||||||
class TestGoIsolation(TestApplicationGo):
|
class TestGoIsolation(TestApplicationGo):
|
||||||
prerequisites = {'modules': {'go': 'any'}, 'features': ['isolation']}
|
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):
|
def unpriv_creds(self):
|
||||||
nobody_uid = pwd.getpwnam('nobody').pw_uid
|
nobody_uid = pwd.getpwnam('nobody').pw_uid
|
||||||
|
|
||||||
@@ -227,7 +231,7 @@ class TestGoIsolation(TestApplicationGo):
|
|||||||
|
|
||||||
obj = self.getjson()['body']
|
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):
|
def test_isolation_namespace_false(self):
|
||||||
self.load('ns_inspect')
|
self.load('ns_inspect')
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ from unit.applications.lang.go import TestApplicationGo
|
|||||||
class TestGoIsolationRootfs(TestApplicationGo):
|
class TestGoIsolationRootfs(TestApplicationGo):
|
||||||
prerequisites = {'modules': {'go': 'all'}}
|
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):
|
def test_go_isolation_rootfs_chroot(self, is_su, temp_dir):
|
||||||
if not is_su:
|
if not is_su:
|
||||||
pytest.skip('requires root')
|
pytest.skip('requires root')
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ class TestPythonProcman(TestApplicationPython):
|
|||||||
output = subprocess.check_output(['ps', 'ax'])
|
output = subprocess.check_output(['ps', 'ax'])
|
||||||
|
|
||||||
pids = set()
|
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))
|
pids.add(re.search(r'^\s*(\d+)', m).group(1))
|
||||||
|
|
||||||
return pids
|
return pids
|
||||||
|
|||||||
@@ -591,7 +591,7 @@ basicConstraints = critical,CA:TRUE"""
|
|||||||
|
|
||||||
subprocess.call(['kill', '-9', app_id])
|
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(
|
self.wait_for_record(
|
||||||
re.compile(
|
re.compile(
|
||||||
|
|||||||
Reference in New Issue
Block a user