summaryrefslogtreecommitdiffhomepage
path: root/test/unit/check
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/check')
-rw-r--r--test/unit/check/check_prerequisites.py1
-rw-r--r--test/unit/check/chroot.py2
-rw-r--r--test/unit/check/discover_available.py2
-rw-r--r--test/unit/check/isolation.py27
-rw-r--r--test/unit/check/node.py4
5 files changed, 20 insertions, 16 deletions
diff --git a/test/unit/check/check_prerequisites.py b/test/unit/check/check_prerequisites.py
index 44c3f10f..ea319346 100644
--- a/test/unit/check/check_prerequisites.py
+++ b/test/unit/check/check_prerequisites.py
@@ -1,4 +1,5 @@
import pytest
+
from unit.option import option
diff --git a/test/unit/check/chroot.py b/test/unit/check/chroot.py
index b749fab6..466b6ba4 100644
--- a/test/unit/check/chroot.py
+++ b/test/unit/check/chroot.py
@@ -15,7 +15,7 @@ def check_chroot():
addr=f'{option.temp_dir}/control.unit.sock',
body=json.dumps(
{
- "listeners": {"*:7080": {"pass": "routes"}},
+ "listeners": {"*:8080": {"pass": "routes"}},
"routes": [
{
"action": {
diff --git a/test/unit/check/discover_available.py b/test/unit/check/discover_available.py
index 0942581b..1383a0c3 100644
--- a/test/unit/check/discover_available.py
+++ b/test/unit/check/discover_available.py
@@ -18,6 +18,8 @@ def discover_available(unit):
[unit['unitd'], '--version'], stderr=subprocess.STDOUT
).decode()
+ option.configure_flag['asan'] = '-fsanitize=address' in output_version
+
# wait for controller start
if Log.wait_for_record(r'controller started') is None:
diff --git a/test/unit/check/isolation.py b/test/unit/check/isolation.py
index e4674f4d..861c0818 100644
--- a/test/unit/check/isolation.py
+++ b/test/unit/check/isolation.py
@@ -1,5 +1,5 @@
import json
-import os
+from pathlib import Path
from unit.applications.lang.go import ApplicationGo
from unit.applications.lang.java import ApplicationJava
@@ -21,7 +21,7 @@ def check_isolation():
ApplicationGo().prepare_env('empty', 'app')
conf = {
- "listeners": {"*:7080": {"pass": "applications/empty"}},
+ "listeners": {"*:8080": {"pass": "applications/empty"}},
"applications": {
"empty": {
"type": "external",
@@ -35,7 +35,7 @@ def check_isolation():
elif 'python' in available['modules']:
conf = {
- "listeners": {"*:7080": {"pass": "applications/empty"}},
+ "listeners": {"*:8080": {"pass": "applications/empty"}},
"applications": {
"empty": {
"type": "python",
@@ -50,7 +50,7 @@ def check_isolation():
elif 'php' in available['modules']:
conf = {
- "listeners": {"*:7080": {"pass": "applications/phpinfo"}},
+ "listeners": {"*:8080": {"pass": "applications/phpinfo"}},
"applications": {
"phpinfo": {
"type": "php",
@@ -67,7 +67,7 @@ def check_isolation():
ApplicationRuby().prepare_env('empty')
conf = {
- "listeners": {"*:7080": {"pass": "applications/empty"}},
+ "listeners": {"*:8080": {"pass": "applications/empty"}},
"applications": {
"empty": {
"type": "ruby",
@@ -83,7 +83,7 @@ def check_isolation():
ApplicationJava().prepare_env('empty')
conf = {
- "listeners": {"*:7080": {"pass": "applications/empty"}},
+ "listeners": {"*:8080": {"pass": "applications/empty"}},
"applications": {
"empty": {
"unit_jars": f"{option.current_dir}/build",
@@ -100,7 +100,7 @@ def check_isolation():
ApplicationNode().prepare_env('basic')
conf = {
- "listeners": {"*:7080": {"pass": "applications/basic"}},
+ "listeners": {"*:8080": {"pass": "applications/basic"}},
"applications": {
"basic": {
"type": "external",
@@ -114,7 +114,7 @@ def check_isolation():
elif 'perl' in available['modules']:
conf = {
- "listeners": {"*:7080": {"pass": "applications/body_empty"}},
+ "listeners": {"*:8080": {"pass": "applications/body_empty"}},
"applications": {
"body_empty": {
"type": "perl",
@@ -145,11 +145,12 @@ def check_isolation():
isolation = {'user': userns}
- unp_clone_path = '/proc/sys/kernel/unprivileged_userns_clone'
- if os.path.exists(unp_clone_path):
- with open(unp_clone_path, 'r') as f:
- if str(f.read()).rstrip() == '1':
- isolation['unprivileged_userns_clone'] = True
+ path_clone = Path('/proc/sys/kernel/unprivileged_userns_clone')
+ if (
+ path_clone.exists()
+ and path_clone.read_text(encoding='utf-8').rstrip() == '1'
+ ):
+ isolation['unprivileged_userns_clone'] = True
for ns in allns:
ns_value = getns(ns)
diff --git a/test/unit/check/node.py b/test/unit/check/node.py
index 6a3d581f..b206e914 100644
--- a/test/unit/check/node.py
+++ b/test/unit/check/node.py
@@ -1,11 +1,11 @@
-import os
import subprocess
+from pathlib import Path
from unit.option import option
def check_node():
- if not os.path.exists(f'{option.current_dir}/node/node_modules'):
+ if not Path(f'{option.current_dir}/node/node_modules').exists():
return False
try: