summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2020-04-24 05:08:56 +0100
committerAndrei Zeliankou <zelenkov@nginx.com>2020-04-24 05:08:56 +0100
commit6a9a4fe0d46263d4d158803d4a82851e240e0e63 (patch)
treef67061d63bbcf79e503b7472713b92dfdf6b6d41 /test
parentaf9392af1fec054119c8ddcd356ade0ea3fbf913 (diff)
downloadunit-6a9a4fe0d46263d4d158803d4a82851e240e0e63.tar.gz
unit-6a9a4fe0d46263d4d158803d4a82851e240e0e63.tar.bz2
Tests: introduced module version specification in prerequisites.
Diffstat (limited to 'test')
-rw-r--r--test/test_access_log.py2
-rw-r--r--test/test_configuration.py2
-rw-r--r--test/test_go_application.py2
-rw-r--r--test/test_go_isolation.py2
-rw-r--r--test/test_http_header.py2
-rw-r--r--test/test_java_application.py2
-rw-r--r--test/test_java_websockets.py2
-rw-r--r--test/test_node_application.py2
-rw-r--r--test/test_node_websockets.py2
-rw-r--r--test/test_perl_application.py2
-rw-r--r--test/test_php_application.py2
-rw-r--r--test/test_php_basic.py2
-rw-r--r--test/test_proxy.py2
-rw-r--r--test/test_python_application.py2
-rw-r--r--test/test_python_basic.py2
-rw-r--r--test/test_python_environment.py2
-rw-r--r--test/test_python_procman.py2
-rw-r--r--test/test_routing.py2
-rw-r--r--test/test_routing_tls.py2
-rw-r--r--test/test_ruby_application.py2
-rw-r--r--test/test_settings.py2
-rw-r--r--test/test_tls.py2
-rw-r--r--test/test_upstreams_rr.py2
-rw-r--r--test/test_usr1.py2
-rw-r--r--test/unit/main.py16
25 files changed, 38 insertions, 26 deletions
diff --git a/test/test_access_log.py b/test/test_access_log.py
index 898d8b24..9287097f 100644
--- a/test/test_access_log.py
+++ b/test/test_access_log.py
@@ -6,7 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestAccessLog(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def load(self, script):
super().load(script)
diff --git a/test/test_configuration.py b/test/test_configuration.py
index daba874b..24efc914 100644
--- a/test/test_configuration.py
+++ b/test/test_configuration.py
@@ -3,7 +3,7 @@ from unit.control import TestControl
class TestConfiguration(TestControl):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def test_json_empty(self):
self.assertIn('error', self.conf(''), 'empty')
diff --git a/test/test_go_application.py b/test/test_go_application.py
index c9d4ba77..b9b78e2b 100644
--- a/test/test_go_application.py
+++ b/test/test_go_application.py
@@ -2,7 +2,7 @@ from unit.applications.lang.go import TestApplicationGo
class TestGoApplication(TestApplicationGo):
- prerequisites = {'modules': ['go']}
+ prerequisites = {'modules': {'go': 'all'}}
def test_go_application_variables(self):
self.load('variables')
diff --git a/test/test_go_isolation.py b/test/test_go_isolation.py
index 7884274d..cf78959a 100644
--- a/test/test_go_isolation.py
+++ b/test/test_go_isolation.py
@@ -7,7 +7,7 @@ from unit.feature.isolation import TestFeatureIsolation
class TestGoIsolation(TestApplicationGo):
- prerequisites = {'modules': ['go'], 'features': ['isolation']}
+ prerequisites = {'modules': {'go': 'any'}, 'features': ['isolation']}
isolation = TestFeatureIsolation()
diff --git a/test/test_http_header.py b/test/test_http_header.py
index b773bd68..00d83f94 100644
--- a/test/test_http_header.py
+++ b/test/test_http_header.py
@@ -3,7 +3,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestHTTPHeader(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def test_http_header_value_leading_sp(self):
self.load('custom_header')
diff --git a/test/test_java_application.py b/test/test_java_application.py
index 7bd351a4..0b4828c7 100644
--- a/test/test_java_application.py
+++ b/test/test_java_application.py
@@ -6,7 +6,7 @@ from unit.applications.lang.java import TestApplicationJava
class TestJavaApplication(TestApplicationJava):
- prerequisites = {'modules': ['java']}
+ prerequisites = {'modules': {'java': 'all'}}
def test_java_conf_error(self):
self.skip_alerts.extend(
diff --git a/test/test_java_websockets.py b/test/test_java_websockets.py
index 7ea04620..0f8f62a5 100644
--- a/test/test_java_websockets.py
+++ b/test/test_java_websockets.py
@@ -6,7 +6,7 @@ from unit.applications.websockets import TestApplicationWebsocket
class TestJavaWebsockets(TestApplicationJava):
- prerequisites = {'modules': ['java']}
+ prerequisites = {'modules': {'java': 'any'}}
ws = TestApplicationWebsocket()
diff --git a/test/test_node_application.py b/test/test_node_application.py
index 174af15d..ed32357d 100644
--- a/test/test_node_application.py
+++ b/test/test_node_application.py
@@ -3,7 +3,7 @@ from unit.applications.lang.node import TestApplicationNode
class TestNodeApplication(TestApplicationNode):
- prerequisites = {'modules': ['node']}
+ prerequisites = {'modules': {'node': 'all'}}
def test_node_application_basic(self):
self.load('basic')
diff --git a/test/test_node_websockets.py b/test/test_node_websockets.py
index 4ce727db..14921991 100644
--- a/test/test_node_websockets.py
+++ b/test/test_node_websockets.py
@@ -6,7 +6,7 @@ from unit.applications.websockets import TestApplicationWebsocket
class TestNodeWebsockets(TestApplicationNode):
- prerequisites = {'modules': ['node']}
+ prerequisites = {'modules': {'node': 'any'}}
ws = TestApplicationWebsocket()
diff --git a/test/test_perl_application.py b/test/test_perl_application.py
index cc4eb915..612c0792 100644
--- a/test/test_perl_application.py
+++ b/test/test_perl_application.py
@@ -3,7 +3,7 @@ from unit.applications.lang.perl import TestApplicationPerl
class TestPerlApplication(TestApplicationPerl):
- prerequisites = {'modules': ['perl']}
+ prerequisites = {'modules': {'perl': 'all'}}
def test_perl_application(self):
self.load('variables')
diff --git a/test/test_php_application.py b/test/test_php_application.py
index 48e1e815..746d61d5 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -5,7 +5,7 @@ import unittest
from unit.applications.lang.php import TestApplicationPHP
class TestPHPApplication(TestApplicationPHP):
- prerequisites = {'modules': ['php']}
+ prerequisites = {'modules': {'php': 'all'}}
def before_disable_functions(self):
body = self.get()['body']
diff --git a/test/test_php_basic.py b/test/test_php_basic.py
index 5fde3e00..16483c4a 100644
--- a/test/test_php_basic.py
+++ b/test/test_php_basic.py
@@ -2,7 +2,7 @@ from unit.control import TestControl
class TestPHPBasic(TestControl):
- prerequisites = {'modules': ['php']}
+ prerequisites = {'modules': {'php': 'any'}}
conf_app = {
"app": {
diff --git a/test/test_proxy.py b/test/test_proxy.py
index b539d5f6..852e970f 100644
--- a/test/test_proxy.py
+++ b/test/test_proxy.py
@@ -6,7 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestProxy(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
SERVER_PORT = 7999
diff --git a/test/test_python_application.py b/test/test_python_application.py
index 8d435b48..d7d39be2 100644
--- a/test/test_python_application.py
+++ b/test/test_python_application.py
@@ -8,7 +8,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestPythonApplication(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'all'}}
def findall(self, pattern):
with open(self.testdir + '/unit.log', 'r', errors='ignore') as f:
diff --git a/test/test_python_basic.py b/test/test_python_basic.py
index 3233fca2..d6445ac2 100644
--- a/test/test_python_basic.py
+++ b/test/test_python_basic.py
@@ -2,7 +2,7 @@ from unit.control import TestControl
class TestPythonBasic(TestControl):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
conf_app = {
"app": {
diff --git a/test/test_python_environment.py b/test/test_python_environment.py
index f808f795..a03b96e6 100644
--- a/test/test_python_environment.py
+++ b/test/test_python_environment.py
@@ -2,7 +2,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestPythonEnvironment(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def test_python_environment_name_null(self):
self.load('environment')
diff --git a/test/test_python_procman.py b/test/test_python_procman.py
index a2e6126c..daa2c53d 100644
--- a/test/test_python_procman.py
+++ b/test/test_python_procman.py
@@ -6,7 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestPythonProcman(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def setUp(self):
super().setUp()
diff --git a/test/test_routing.py b/test/test_routing.py
index ad793662..e4f13e29 100644
--- a/test/test_routing.py
+++ b/test/test_routing.py
@@ -3,7 +3,7 @@ from unit.applications.proto import TestApplicationProto
class TestRouting(TestApplicationProto):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def setUp(self):
super().setUp()
diff --git a/test/test_routing_tls.py b/test/test_routing_tls.py
index 36bd9057..a9b8f88d 100644
--- a/test/test_routing_tls.py
+++ b/test/test_routing_tls.py
@@ -2,7 +2,7 @@ from unit.applications.tls import TestApplicationTLS
class TestRoutingTLS(TestApplicationTLS):
- prerequisites = {'modules': ['openssl']}
+ prerequisites = {'modules': {'openssl': 'any'}}
def test_routes_match_scheme_tls(self):
self.certificate()
diff --git a/test/test_ruby_application.py b/test/test_ruby_application.py
index bdaabe51..90ebd6a8 100644
--- a/test/test_ruby_application.py
+++ b/test/test_ruby_application.py
@@ -3,7 +3,7 @@ from unit.applications.lang.ruby import TestApplicationRuby
class TestRubyApplication(TestApplicationRuby):
- prerequisites = {'modules': ['ruby']}
+ prerequisites = {'modules': {'ruby': 'all'}}
def test_ruby_application(self):
self.load('variables')
diff --git a/test/test_settings.py b/test/test_settings.py
index 9de3a928..0b471d4e 100644
--- a/test/test_settings.py
+++ b/test/test_settings.py
@@ -5,7 +5,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestSettings(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def test_settings_header_read_timeout(self):
self.load('empty')
diff --git a/test/test_tls.py b/test/test_tls.py
index d9dcf237..c482bf5a 100644
--- a/test/test_tls.py
+++ b/test/test_tls.py
@@ -8,7 +8,7 @@ from unit.applications.tls import TestApplicationTLS
class TestTLS(TestApplicationTLS):
- prerequisites = {'modules': ['python', 'openssl']}
+ prerequisites = {'modules': {'python': 'any', 'openssl': 'any'}}
def findall(self, pattern):
with open(self.testdir + '/unit.log', 'r', errors='ignore') as f:
diff --git a/test/test_upstreams_rr.py b/test/test_upstreams_rr.py
index 7045318a..56d4cbbb 100644
--- a/test/test_upstreams_rr.py
+++ b/test/test_upstreams_rr.py
@@ -5,7 +5,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestUpstreamsRR(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def setUp(self):
super().setUp()
diff --git a/test/test_usr1.py b/test/test_usr1.py
index 155303ea..0627ca1d 100644
--- a/test/test_usr1.py
+++ b/test/test_usr1.py
@@ -5,7 +5,7 @@ from unit.applications.lang.python import TestApplicationPython
class TestUSR1(TestApplicationPython):
- prerequisites = {'modules': ['python']}
+ prerequisites = {'modules': {'python': 'any'}}
def test_usr1_access_log(self):
self.load('empty')
diff --git a/test/unit/main.py b/test/unit/main.py
index 4507f71a..074d053e 100644
--- a/test/unit/main.py
+++ b/test/unit/main.py
@@ -52,9 +52,21 @@ class TestUnit(unittest.TestCase):
type = self.application_type
for module in self.prerequisites['modules']:
if module in self.available['modules']:
- for version in self.available['modules'][module]:
- self.application_type = type + ' ' + version
+ prereq_version = self.prerequisites['modules'][module]
+ available_versions = self.available['modules'][module]
+
+ if prereq_version == 'all':
+ for version in available_versions:
+ self.application_type = type + ' ' + version
+ super().run(result)
+ elif prereq_version == 'any':
+ self.application_type = type + ' ' + available_versions[0]
super().run(result)
+ else:
+ for version in available_versions:
+ if version.startswith(prereq_version):
+ self.application_type = type + ' ' + version
+ super().run(result)
@classmethod
def main(cls):