summaryrefslogtreecommitdiffhomepage
path: root/test/unit/applications
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2021-08-19 18:17:12 +0300
committerAndrei Belov <defan@nginx.com>2021-08-19 18:17:12 +0300
commitdb442f1be7e713e6a219621ff97a51046590dbd6 (patch)
tree913734275bc890ec175e51fcb0f36b01a3c52c24 /test/unit/applications
parenta1d2ced6fc2317d36bc917c5d0ac339bc647dc34 (diff)
parent13c0025dfa6e041563d0ad5dd81679b44522694c (diff)
downloadunit-1.25.0-1.tar.gz
unit-1.25.0-1.tar.bz2
Merged with the default branch.1.25.0-1
Diffstat (limited to '')
-rw-r--r--test/unit/applications/lang/java.py2
-rw-r--r--test/unit/applications/lang/python.py1
-rw-r--r--test/unit/applications/lang/ruby.py38
-rw-r--r--test/unit/applications/proto.py16
4 files changed, 40 insertions, 17 deletions
diff --git a/test/unit/applications/lang/java.py b/test/unit/applications/lang/java.py
index c9c2095e..53b27b07 100644
--- a/test/unit/applications/lang/java.py
+++ b/test/unit/applications/lang/java.py
@@ -52,7 +52,7 @@ class TestApplicationJava(TestApplicationProto):
os.makedirs(classes_path)
classpath = (
- option.current_dir + '/build/tomcat-servlet-api-9.0.44.jar'
+ option.current_dir + '/build/tomcat-servlet-api-9.0.52.jar'
)
ws_jars = glob.glob(
diff --git a/test/unit/applications/lang/python.py b/test/unit/applications/lang/python.py
index b399dffd..215aa332 100644
--- a/test/unit/applications/lang/python.py
+++ b/test/unit/applications/lang/python.py
@@ -44,6 +44,7 @@ class TestApplicationPython(TestApplicationProto):
for attr in (
'callable',
+ 'environment',
'home',
'limits',
'path',
diff --git a/test/unit/applications/lang/ruby.py b/test/unit/applications/lang/ruby.py
index 02644584..61d50558 100644
--- a/test/unit/applications/lang/ruby.py
+++ b/test/unit/applications/lang/ruby.py
@@ -1,24 +1,44 @@
+import os
+import shutil
+
from unit.applications.proto import TestApplicationProto
from unit.option import option
+from unit.utils import public_dir
class TestApplicationRuby(TestApplicationProto):
application_type = "ruby"
+ def prepare_env(self, script):
+ shutil.copytree(
+ option.test_dir + '/ruby/' + script,
+ option.temp_dir + '/ruby/' + script,
+ )
+
+ public_dir(option.temp_dir + '/ruby/' + script)
+
def load(self, script, name='config.ru', **kwargs):
- script_path = option.test_dir + '/ruby/' + script
+ self.prepare_env(script)
+
+ script_path = option.temp_dir + '/ruby/' + script
+
+ app = {
+ "type": self.get_application_type(),
+ "processes": {"spare": 0},
+ "working_directory": script_path,
+ "script": script_path + '/' + name,
+ }
+
+ for key in [
+ 'hooks',
+ ]:
+ if key in kwargs:
+ app[key] = kwargs[key]
self._load_conf(
{
"listeners": {"*:7080": {"pass": "applications/" + script}},
- "applications": {
- script: {
- "type": self.get_application_type(),
- "processes": {"spare": 0},
- "working_directory": script_path,
- "script": script_path + '/' + name,
- }
- },
+ "applications": {script: app},
},
**kwargs
)
diff --git a/test/unit/applications/proto.py b/test/unit/applications/proto.py
index 92754c03..e30d21ff 100644
--- a/test/unit/applications/proto.py
+++ b/test/unit/applications/proto.py
@@ -47,13 +47,15 @@ class TestApplicationProto(TestControl):
if 'applications' in conf:
for app in conf['applications'].keys():
app_conf = conf['applications'][app]
- if 'user' in kwargs:
- app_conf['user'] = kwargs['user']
- if 'group' in kwargs:
- app_conf['group'] = kwargs['group']
-
- if 'isolation' in kwargs:
- app_conf['isolation'] = kwargs['isolation']
+ for key in [
+ 'user',
+ 'group',
+ 'isolation',
+ 'processes',
+ 'threads',
+ ]:
+ if key in kwargs:
+ app_conf[key] = kwargs[key]
assert 'success' in self.conf(conf), 'load application configuration'