Tests: introduced module version specification in prerequisites.
This commit is contained in:
@@ -6,7 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestAccessLog(TestApplicationPython):
|
class TestAccessLog(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def load(self, script):
|
def load(self, script):
|
||||||
super().load(script)
|
super().load(script)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from unit.control import TestControl
|
|||||||
|
|
||||||
|
|
||||||
class TestConfiguration(TestControl):
|
class TestConfiguration(TestControl):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def test_json_empty(self):
|
def test_json_empty(self):
|
||||||
self.assertIn('error', self.conf(''), 'empty')
|
self.assertIn('error', self.conf(''), 'empty')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from unit.applications.lang.go import TestApplicationGo
|
|||||||
|
|
||||||
|
|
||||||
class TestGoApplication(TestApplicationGo):
|
class TestGoApplication(TestApplicationGo):
|
||||||
prerequisites = {'modules': ['go']}
|
prerequisites = {'modules': {'go': 'all'}}
|
||||||
|
|
||||||
def test_go_application_variables(self):
|
def test_go_application_variables(self):
|
||||||
self.load('variables')
|
self.load('variables')
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from unit.feature.isolation import TestFeatureIsolation
|
|||||||
|
|
||||||
|
|
||||||
class TestGoIsolation(TestApplicationGo):
|
class TestGoIsolation(TestApplicationGo):
|
||||||
prerequisites = {'modules': ['go'], 'features': ['isolation']}
|
prerequisites = {'modules': {'go': 'any'}, 'features': ['isolation']}
|
||||||
|
|
||||||
isolation = TestFeatureIsolation()
|
isolation = TestFeatureIsolation()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestHTTPHeader(TestApplicationPython):
|
class TestHTTPHeader(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def test_http_header_value_leading_sp(self):
|
def test_http_header_value_leading_sp(self):
|
||||||
self.load('custom_header')
|
self.load('custom_header')
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from unit.applications.lang.java import TestApplicationJava
|
|||||||
|
|
||||||
|
|
||||||
class TestJavaApplication(TestApplicationJava):
|
class TestJavaApplication(TestApplicationJava):
|
||||||
prerequisites = {'modules': ['java']}
|
prerequisites = {'modules': {'java': 'all'}}
|
||||||
|
|
||||||
def test_java_conf_error(self):
|
def test_java_conf_error(self):
|
||||||
self.skip_alerts.extend(
|
self.skip_alerts.extend(
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from unit.applications.websockets import TestApplicationWebsocket
|
|||||||
|
|
||||||
|
|
||||||
class TestJavaWebsockets(TestApplicationJava):
|
class TestJavaWebsockets(TestApplicationJava):
|
||||||
prerequisites = {'modules': ['java']}
|
prerequisites = {'modules': {'java': 'any'}}
|
||||||
|
|
||||||
ws = TestApplicationWebsocket()
|
ws = TestApplicationWebsocket()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from unit.applications.lang.node import TestApplicationNode
|
|||||||
|
|
||||||
|
|
||||||
class TestNodeApplication(TestApplicationNode):
|
class TestNodeApplication(TestApplicationNode):
|
||||||
prerequisites = {'modules': ['node']}
|
prerequisites = {'modules': {'node': 'all'}}
|
||||||
|
|
||||||
def test_node_application_basic(self):
|
def test_node_application_basic(self):
|
||||||
self.load('basic')
|
self.load('basic')
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from unit.applications.websockets import TestApplicationWebsocket
|
|||||||
|
|
||||||
|
|
||||||
class TestNodeWebsockets(TestApplicationNode):
|
class TestNodeWebsockets(TestApplicationNode):
|
||||||
prerequisites = {'modules': ['node']}
|
prerequisites = {'modules': {'node': 'any'}}
|
||||||
|
|
||||||
ws = TestApplicationWebsocket()
|
ws = TestApplicationWebsocket()
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from unit.applications.lang.perl import TestApplicationPerl
|
|||||||
|
|
||||||
|
|
||||||
class TestPerlApplication(TestApplicationPerl):
|
class TestPerlApplication(TestApplicationPerl):
|
||||||
prerequisites = {'modules': ['perl']}
|
prerequisites = {'modules': {'perl': 'all'}}
|
||||||
|
|
||||||
def test_perl_application(self):
|
def test_perl_application(self):
|
||||||
self.load('variables')
|
self.load('variables')
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import unittest
|
|||||||
from unit.applications.lang.php import TestApplicationPHP
|
from unit.applications.lang.php import TestApplicationPHP
|
||||||
|
|
||||||
class TestPHPApplication(TestApplicationPHP):
|
class TestPHPApplication(TestApplicationPHP):
|
||||||
prerequisites = {'modules': ['php']}
|
prerequisites = {'modules': {'php': 'all'}}
|
||||||
|
|
||||||
def before_disable_functions(self):
|
def before_disable_functions(self):
|
||||||
body = self.get()['body']
|
body = self.get()['body']
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from unit.control import TestControl
|
|||||||
|
|
||||||
|
|
||||||
class TestPHPBasic(TestControl):
|
class TestPHPBasic(TestControl):
|
||||||
prerequisites = {'modules': ['php']}
|
prerequisites = {'modules': {'php': 'any'}}
|
||||||
|
|
||||||
conf_app = {
|
conf_app = {
|
||||||
"app": {
|
"app": {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestProxy(TestApplicationPython):
|
class TestProxy(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
SERVER_PORT = 7999
|
SERVER_PORT = 7999
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestPythonApplication(TestApplicationPython):
|
class TestPythonApplication(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'all'}}
|
||||||
|
|
||||||
def findall(self, pattern):
|
def findall(self, pattern):
|
||||||
with open(self.testdir + '/unit.log', 'r', errors='ignore') as f:
|
with open(self.testdir + '/unit.log', 'r', errors='ignore') as f:
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from unit.control import TestControl
|
|||||||
|
|
||||||
|
|
||||||
class TestPythonBasic(TestControl):
|
class TestPythonBasic(TestControl):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
conf_app = {
|
conf_app = {
|
||||||
"app": {
|
"app": {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestPythonEnvironment(TestApplicationPython):
|
class TestPythonEnvironment(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def test_python_environment_name_null(self):
|
def test_python_environment_name_null(self):
|
||||||
self.load('environment')
|
self.load('environment')
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestPythonProcman(TestApplicationPython):
|
class TestPythonProcman(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from unit.applications.proto import TestApplicationProto
|
|||||||
|
|
||||||
|
|
||||||
class TestRouting(TestApplicationProto):
|
class TestRouting(TestApplicationProto):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from unit.applications.tls import TestApplicationTLS
|
|||||||
|
|
||||||
|
|
||||||
class TestRoutingTLS(TestApplicationTLS):
|
class TestRoutingTLS(TestApplicationTLS):
|
||||||
prerequisites = {'modules': ['openssl']}
|
prerequisites = {'modules': {'openssl': 'any'}}
|
||||||
|
|
||||||
def test_routes_match_scheme_tls(self):
|
def test_routes_match_scheme_tls(self):
|
||||||
self.certificate()
|
self.certificate()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ from unit.applications.lang.ruby import TestApplicationRuby
|
|||||||
|
|
||||||
|
|
||||||
class TestRubyApplication(TestApplicationRuby):
|
class TestRubyApplication(TestApplicationRuby):
|
||||||
prerequisites = {'modules': ['ruby']}
|
prerequisites = {'modules': {'ruby': 'all'}}
|
||||||
|
|
||||||
def test_ruby_application(self):
|
def test_ruby_application(self):
|
||||||
self.load('variables')
|
self.load('variables')
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestSettings(TestApplicationPython):
|
class TestSettings(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def test_settings_header_read_timeout(self):
|
def test_settings_header_read_timeout(self):
|
||||||
self.load('empty')
|
self.load('empty')
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from unit.applications.tls import TestApplicationTLS
|
|||||||
|
|
||||||
|
|
||||||
class TestTLS(TestApplicationTLS):
|
class TestTLS(TestApplicationTLS):
|
||||||
prerequisites = {'modules': ['python', 'openssl']}
|
prerequisites = {'modules': {'python': 'any', 'openssl': 'any'}}
|
||||||
|
|
||||||
def findall(self, pattern):
|
def findall(self, pattern):
|
||||||
with open(self.testdir + '/unit.log', 'r', errors='ignore') as f:
|
with open(self.testdir + '/unit.log', 'r', errors='ignore') as f:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestUpstreamsRR(TestApplicationPython):
|
class TestUpstreamsRR(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super().setUp()
|
super().setUp()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from unit.applications.lang.python import TestApplicationPython
|
|||||||
|
|
||||||
|
|
||||||
class TestUSR1(TestApplicationPython):
|
class TestUSR1(TestApplicationPython):
|
||||||
prerequisites = {'modules': ['python']}
|
prerequisites = {'modules': {'python': 'any'}}
|
||||||
|
|
||||||
def test_usr1_access_log(self):
|
def test_usr1_access_log(self):
|
||||||
self.load('empty')
|
self.load('empty')
|
||||||
|
|||||||
@@ -52,7 +52,19 @@ class TestUnit(unittest.TestCase):
|
|||||||
type = self.application_type
|
type = self.application_type
|
||||||
for module in self.prerequisites['modules']:
|
for module in self.prerequisites['modules']:
|
||||||
if module in self.available['modules']:
|
if module in self.available['modules']:
|
||||||
for version in self.available['modules'][module]:
|
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
|
self.application_type = type + ' ' + version
|
||||||
super().run(result)
|
super().run(result)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user