summaryrefslogtreecommitdiffhomepage
path: root/test/unit.py
diff options
context:
space:
mode:
authorSergey Kandaurov <pluknet@nginx.com>2018-10-25 15:43:48 +0300
committerSergey Kandaurov <pluknet@nginx.com>2018-10-25 15:43:48 +0300
commit0fdc7c3a55daceb54c034a51b30f06a932236965 (patch)
treee55e5f320d13934f0dfb742b8c0ec19962f0220d /test/unit.py
parent41d3d63758fc3846d5a09afd3b33aac19231942a (diff)
downloadunit-0fdc7c3a55daceb54c034a51b30f06a932236965.tar.gz
unit-0fdc7c3a55daceb54c034a51b30f06a932236965.tar.bz2
Tests: Node.js application tests.
Diffstat (limited to 'test/unit.py')
-rw-r--r--test/unit.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/unit.py b/test/unit.py
index c3efef26..e88ed684 100644
--- a/test/unit.py
+++ b/test/unit.py
@@ -117,6 +117,12 @@ class TestUnit(unittest.TestCase):
except:
m = None
+ elif module == 'node':
+ if os.path.isdir(self.pardir + '/node/node_modules'):
+ m = module
+ else:
+ m = None
+
elif module == 'openssl':
try:
subprocess.check_output(['which', 'openssl'])
@@ -558,6 +564,35 @@ class TestUnitApplicationGo(TestUnitApplicationProto):
}
})
+class TestUnitApplicationNode(TestUnitApplicationProto):
+ def load(self, script, name='app.js'):
+
+ # copy application
+
+ shutil.copytree(self.current_dir + '/node/' + script,
+ self.testdir + '/node')
+
+ # link modules
+
+ os.symlink(self.pardir + '/node/node_modules',
+ self.testdir + '/node/node_modules')
+
+ self.conf({
+ "listeners": {
+ "*:7080": {
+ "application": script
+ }
+ },
+ "applications": {
+ script: {
+ "type": "external",
+ "processes": { "spare": 0 },
+ "working_directory": self.testdir + '/node',
+ "executable": name
+ }
+ }
+ })
+
class TestUnitApplicationPerl(TestUnitApplicationProto):
def load(self, script, name='psgi.pl'):
self.conf({