summaryrefslogtreecommitdiffhomepage
path: root/test/unit/applications
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2020-10-19 22:25:29 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2020-10-19 22:25:29 +0100
commit54837759f36eddb80af22c8d73e103a948221dc7 (patch)
tree420c6ce21ad3868db4037d160406f7754bb392e5 /test/unit/applications
parentd8628a43d0705deeb3473faf0252288038defc2b (diff)
downloadunit-54837759f36eddb80af22c8d73e103a948221dc7.tar.gz
unit-54837759f36eddb80af22c8d73e103a948221dc7.tar.bz2
Tests: fixed unit.log print.
Diffstat (limited to '')
-rw-r--r--test/unit/applications/lang/go.py10
-rw-r--r--test/unit/applications/lang/java.py2
-rw-r--r--test/unit/applications/lang/node.py8
-rw-r--r--test/unit/applications/lang/python.py1
-rw-r--r--test/unit/applications/proto.py2
-rw-r--r--test/unit/applications/tls.py14
6 files changed, 17 insertions, 20 deletions
diff --git a/test/unit/applications/lang/go.py b/test/unit/applications/lang/go.py
index 7715bd6c..518cd017 100644
--- a/test/unit/applications/lang/go.py
+++ b/test/unit/applications/lang/go.py
@@ -7,8 +7,8 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationGo(TestApplicationProto):
def prepare_env(self, script, name, static=False):
- if not os.path.exists(self.temp_dir + '/go'):
- os.mkdir(self.temp_dir + '/go')
+ if not os.path.exists(option.temp_dir + '/go'):
+ os.mkdir(option.temp_dir + '/go')
env = os.environ.copy()
env['GOPATH'] = option.current_dir + '/build/go'
@@ -22,7 +22,7 @@ class TestApplicationGo(TestApplicationProto):
'-ldflags',
'-extldflags "-static"',
'-o',
- self.temp_dir + '/go/' + name,
+ option.temp_dir + '/go/' + name,
option.test_dir + '/go/' + script + '/' + name + '.go',
]
else:
@@ -30,7 +30,7 @@ class TestApplicationGo(TestApplicationProto):
'go',
'build',
'-o',
- self.temp_dir + '/go/' + name,
+ option.temp_dir + '/go/' + name,
option.test_dir + '/go/' + script + '/' + name + '.go',
]
@@ -47,7 +47,7 @@ class TestApplicationGo(TestApplicationProto):
static_build = False
wdir = option.test_dir + "/go/" + script
- executable = self.temp_dir + "/go/" + name
+ executable = option.temp_dir + "/go/" + name
if 'isolation' in kwargs and 'rootfs' in kwargs['isolation']:
wdir = "/go/"
diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py
index 01cbfa0b..a034d9a4 100644
--- a/test/unit/applications/lang/java.py
+++ b/test/unit/applications/lang/java.py
@@ -10,7 +10,7 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationJava(TestApplicationProto):
def load(self, script, name='app', **kwargs):
- app_path = self.temp_dir + '/java'
+ app_path = option.temp_dir + '/java'
web_inf_path = app_path + '/WEB-INF/'
classes_path = web_inf_path + 'classes/'
script_path = option.test_dir + '/java/' + script + '/'
diff --git a/test/unit/applications/lang/node.py b/test/unit/applications/lang/node.py
index 877fc461..4aa9eb1c 100644
--- a/test/unit/applications/lang/node.py
+++ b/test/unit/applications/lang/node.py
@@ -11,17 +11,17 @@ class TestApplicationNode(TestApplicationProto):
# copy application
shutil.copytree(
- option.test_dir + '/node/' + script, self.temp_dir + '/node'
+ option.test_dir + '/node/' + script, option.temp_dir + '/node'
)
# copy modules
shutil.copytree(
option.current_dir + '/node/node_modules',
- self.temp_dir + '/node/node_modules',
+ option.temp_dir + '/node/node_modules',
)
- public_dir(self.temp_dir + '/node')
+ public_dir(option.temp_dir + '/node')
self._load_conf(
{
@@ -32,7 +32,7 @@ class TestApplicationNode(TestApplicationProto):
script: {
"type": "external",
"processes": {"spare": 0},
- "working_directory": self.temp_dir + '/node',
+ "working_directory": option.temp_dir + '/node',
"executable": name,
}
},
diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py
index 47b95dac..a4a27bb9 100644
--- a/test/unit/applications/lang/python.py
+++ b/test/unit/applications/lang/python.py
@@ -12,7 +12,6 @@ class TestApplicationPython(TestApplicationProto):
load_module = "wsgi"
def load(self, script, name=None, module=None, **kwargs):
- print()
if name is None:
name = script
diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py
index 2f748c21..9a0361d5 100644
--- a/test/unit/applications/proto.py
+++ b/test/unit/applications/proto.py
@@ -14,7 +14,7 @@ class TestApplicationProto(TestControl):
return time.mktime(time.strptime(date, template))
def search_in_log(self, pattern, name='unit.log'):
- with open(self.temp_dir + '/' + name, 'r', errors='ignore') as f:
+ with open(option.temp_dir + '/' + name, 'r', errors='ignore') as f:
return re.search(pattern, f.read())
def wait_for_record(self, pattern, name='unit.log'):
diff --git a/test/unit/applications/tls.py b/test/unit/applications/tls.py
index fdf681ae..fb1b112c 100644
--- a/test/unit/applications/tls.py
+++ b/test/unit/applications/tls.py
@@ -8,8 +8,6 @@ from unit.applications.proto import TestApplicationProto
class TestApplicationTLS(TestApplicationProto):
def setup_method(self):
- super().setup_method()
-
self.context = ssl.create_default_context()
self.context.check_hostname = False
self.context.verify_mode = ssl.CERT_NONE
@@ -24,9 +22,9 @@ class TestApplicationTLS(TestApplicationProto):
'-x509',
'-new',
'-subj', '/CN=' + name + '/',
- '-config', self.temp_dir + '/openssl.conf',
- '-out', self.temp_dir + '/' + name + '.crt',
- '-keyout', self.temp_dir + '/' + name + '.key',
+ '-config', option.temp_dir + '/openssl.conf',
+ '-out', option.temp_dir + '/' + name + '.crt',
+ '-keyout', option.temp_dir + '/' + name + '.key',
],
stderr=subprocess.STDOUT,
)
@@ -38,8 +36,8 @@ class TestApplicationTLS(TestApplicationProto):
if key is None:
key = crt
- key_path = self.temp_dir + '/' + key + '.key'
- crt_path = self.temp_dir + '/' + crt + '.crt'
+ key_path = option.temp_dir + '/' + key + '.key'
+ crt_path = option.temp_dir + '/' + crt + '.crt'
with open(key_path, 'rb') as k, open(crt_path, 'rb') as c:
return self.conf(k.read() + c.read(), '/certificates/' + crt)
@@ -66,7 +64,7 @@ class TestApplicationTLS(TestApplicationProto):
return ssl.get_server_certificate(addr, ssl_version=ssl_version)
def openssl_conf(self):
- conf_path = self.temp_dir + '/openssl.conf'
+ conf_path = option.temp_dir + '/openssl.conf'
if os.path.exists(conf_path):
return