Tests: added missing checks for configuration results.
This commit is contained in:
@@ -90,7 +90,9 @@ Connection: close
|
||||
def test_access_log_ipv6(self):
|
||||
self.load('empty')
|
||||
|
||||
self.conf({"[::1]:7080": {"pass": "applications/empty"}}, 'listeners')
|
||||
assert 'success' in self.conf(
|
||||
{"[::1]:7080": {"pass": "applications/empty"}}, 'listeners'
|
||||
)
|
||||
|
||||
self.get(sock_type='ipv6')
|
||||
|
||||
@@ -106,7 +108,7 @@ Connection: close
|
||||
|
||||
addr = option.temp_dir + '/sock'
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"unix:" + addr: {"pass": "applications/empty"}}, 'listeners'
|
||||
)
|
||||
|
||||
@@ -240,7 +242,7 @@ Connection: close
|
||||
def test_access_log_delete(self):
|
||||
self.load('empty')
|
||||
|
||||
self.conf_delete('access_log')
|
||||
assert 'success' in self.conf_delete('access_log')
|
||||
|
||||
self.get(url='/delete')
|
||||
|
||||
@@ -251,7 +253,9 @@ Connection: close
|
||||
|
||||
self.get()
|
||||
|
||||
self.conf('"' + option.temp_dir + '/new.log"', 'access_log')
|
||||
assert 'success' in self.conf(
|
||||
'"' + option.temp_dir + '/new.log"', 'access_log'
|
||||
)
|
||||
|
||||
self.get()
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ class TestGoApplication(TestApplicationGo):
|
||||
arg2 = '--cc-opt=\'-O0 -DNXT_DEBUG_MEMORY=1 -fsanitize=address\''
|
||||
arg3 = '--debug'
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
'["' + arg1 + '", "' + arg2 + '", "' + arg3 + '"]',
|
||||
'applications/command_line_arguments/arguments',
|
||||
)
|
||||
@@ -163,15 +163,15 @@ class TestGoApplication(TestApplicationGo):
|
||||
|
||||
args_path = 'applications/command_line_arguments/arguments'
|
||||
|
||||
self.conf('["0", "a", "$", ""]', args_path)
|
||||
assert 'success' in self.conf('["0", "a", "$", ""]', args_path)
|
||||
|
||||
assert self.get()['body'] == '0,a,$,', 'arguments'
|
||||
|
||||
self.conf('["-1", "b", "%"]', args_path)
|
||||
assert 'success' in self.conf('["-1", "b", "%"]', args_path)
|
||||
|
||||
assert self.get()['body'] == '-1,b,%', 'arguments change'
|
||||
|
||||
self.conf('[]', args_path)
|
||||
assert 'success' in self.conf('[]', args_path)
|
||||
|
||||
assert (
|
||||
self.get()['headers']['Content-Length'] == '0'
|
||||
|
||||
@@ -268,7 +268,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
|
||||
assert self.get()['headers']['X-Precision'] != '4', 'ini value default'
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"file": "ini/php.ini"}, 'applications/ini_precision/options'
|
||||
)
|
||||
|
||||
@@ -290,7 +290,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
def test_php_application_ini_admin(self):
|
||||
self.load('ini_precision')
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"file": "php.ini", "admin": {"precision": "5"}},
|
||||
'applications/ini_precision/options',
|
||||
)
|
||||
@@ -300,7 +300,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
def test_php_application_ini_user(self):
|
||||
self.load('ini_precision')
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"file": "php.ini", "user": {"precision": "5"}},
|
||||
'applications/ini_precision/options',
|
||||
)
|
||||
@@ -310,13 +310,13 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
def test_php_application_ini_user_2(self):
|
||||
self.load('ini_precision')
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"file": "ini/php.ini"}, 'applications/ini_precision/options'
|
||||
)
|
||||
|
||||
assert self.get()['headers']['X-Precision'] == '4', 'ini user file'
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"precision": "5"}, 'applications/ini_precision/options/user'
|
||||
)
|
||||
|
||||
@@ -325,7 +325,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
def test_php_application_ini_set_admin(self):
|
||||
self.load('ini_precision')
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"admin": {"precision": "5"}}, 'applications/ini_precision/options'
|
||||
)
|
||||
|
||||
@@ -336,7 +336,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
def test_php_application_ini_set_user(self):
|
||||
self.load('ini_precision')
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"user": {"precision": "5"}}, 'applications/ini_precision/options'
|
||||
)
|
||||
|
||||
@@ -347,7 +347,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
def test_php_application_ini_repeat(self):
|
||||
self.load('ini_precision')
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"user": {"precision": "5"}}, 'applications/ini_precision/options'
|
||||
)
|
||||
|
||||
@@ -360,7 +360,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
|
||||
self.before_disable_functions()
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"admin": {"disable_functions": "exec"}},
|
||||
'applications/time_exec/options',
|
||||
)
|
||||
@@ -375,7 +375,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
|
||||
self.before_disable_functions()
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"admin": {"disable_functions": "exec,time"}},
|
||||
'applications/time_exec/options',
|
||||
)
|
||||
@@ -452,7 +452,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
|
||||
self.before_disable_functions()
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"admin": {"disable_functions": "exec time"}},
|
||||
'applications/time_exec/options',
|
||||
)
|
||||
@@ -471,7 +471,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
|
||||
self.before_disable_functions()
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"user": {"disable_functions": "exec"}},
|
||||
'applications/time_exec/options',
|
||||
)
|
||||
@@ -488,7 +488,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
|
||||
self.before_disable_functions()
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"admin": {"disable_functions": "blah"}},
|
||||
'applications/time_exec/options',
|
||||
)
|
||||
@@ -509,7 +509,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
r'012345', self.get()['body']
|
||||
), 'disable_classes before'
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"admin": {"disable_classes": "DateTime"}},
|
||||
'applications/date_time/options',
|
||||
)
|
||||
@@ -525,7 +525,7 @@ class TestPHPApplication(TestApplicationPHP):
|
||||
r'012345', self.get()['body']
|
||||
), 'disable_classes before'
|
||||
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"user": {"disable_classes": "DateTime"}},
|
||||
'applications/date_time/options',
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ class TestPHPBasic(TestControl):
|
||||
}
|
||||
|
||||
def test_php_get_applications(self):
|
||||
self.conf(self.conf_app, 'applications')
|
||||
assert 'success' in self.conf(self.conf_app, 'applications')
|
||||
|
||||
conf = self.conf_get()
|
||||
|
||||
@@ -55,7 +55,7 @@ class TestPHPBasic(TestControl):
|
||||
), 'spare processes'
|
||||
|
||||
def test_php_get_listeners(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
assert self.conf_get()['listeners'] == {
|
||||
"*:7080": {"pass": "applications/app"}
|
||||
@@ -70,16 +70,20 @@ class TestPHPBasic(TestControl):
|
||||
}, 'listeners prefix 2'
|
||||
|
||||
def test_php_change_listener(self):
|
||||
self.conf(self.conf_basic)
|
||||
self.conf({"*:7081": {"pass": "applications/app"}}, 'listeners')
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(
|
||||
{"*:7081": {"pass": "applications/app"}}, 'listeners'
|
||||
)
|
||||
|
||||
assert self.conf_get('listeners') == {
|
||||
"*:7081": {"pass": "applications/app"}
|
||||
}, 'change listener'
|
||||
|
||||
def test_php_add_listener(self):
|
||||
self.conf(self.conf_basic)
|
||||
self.conf({"pass": "applications/app"}, 'listeners/*:7082')
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(
|
||||
{"pass": "applications/app"}, 'listeners/*:7082'
|
||||
)
|
||||
|
||||
assert self.conf_get('listeners') == {
|
||||
"*:7080": {"pass": "applications/app"},
|
||||
@@ -87,20 +91,20 @@ class TestPHPBasic(TestControl):
|
||||
}, 'add listener'
|
||||
|
||||
def test_php_change_application(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
self.conf('30', 'applications/app/processes/max')
|
||||
assert 'success' in self.conf('30', 'applications/app/processes/max')
|
||||
assert (
|
||||
self.conf_get('applications/app/processes/max') == 30
|
||||
), 'change application max'
|
||||
|
||||
self.conf('"/www"', 'applications/app/root')
|
||||
assert 'success' in self.conf('"/www"', 'applications/app/root')
|
||||
assert (
|
||||
self.conf_get('applications/app/root') == '/www'
|
||||
), 'change application root'
|
||||
|
||||
def test_php_delete(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
assert 'error' in self.conf_delete('applications/app')
|
||||
assert 'success' in self.conf_delete('listeners/*:7080')
|
||||
@@ -108,7 +112,7 @@ class TestPHPBasic(TestControl):
|
||||
assert 'error' in self.conf_delete('applications/app')
|
||||
|
||||
def test_php_delete_blocks(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
assert 'success' in self.conf_delete('listeners')
|
||||
assert 'success' in self.conf_delete('applications')
|
||||
|
||||
@@ -172,7 +172,9 @@ Content-Length: 10
|
||||
assert resp['status'] == 200, 'status'
|
||||
assert resp['body'] == payload, 'body'
|
||||
|
||||
self.conf({'http': {'max_body_size': 32 * 1024 * 1024}}, 'settings')
|
||||
assert 'success' in self.conf(
|
||||
{'http': {'max_body_size': 32 * 1024 * 1024}}, 'settings'
|
||||
)
|
||||
|
||||
payload = '0123456789abcdef' * 32 * 64 * 1024
|
||||
resp = self.post_http10(body=payload, read_buffer_size=1024 * 1024)
|
||||
@@ -486,7 +488,7 @@ Content-Length: 10
|
||||
r'accept.*failed',
|
||||
r'new connections are not accepted',
|
||||
)
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{
|
||||
"listeners": {
|
||||
"*:7080": {"pass": "routes"},
|
||||
|
||||
@@ -153,7 +153,7 @@ custom-header: BLAH
|
||||
assert resp['status'] == 200, 'ctx iter status'
|
||||
assert resp['body'] == '0123456789', 'ctx iter body'
|
||||
|
||||
self.conf({"listeners": {}, "applications": {}})
|
||||
assert 'success' in self.conf({"listeners": {}, "applications": {}})
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'RuntimeError') is not None
|
||||
@@ -331,7 +331,7 @@ Connection: close
|
||||
|
||||
self.get()
|
||||
|
||||
self.conf({"listeners": {}, "applications": {}})
|
||||
assert 'success' in self.conf({"listeners": {}, "applications": {}})
|
||||
|
||||
assert self.wait_for_record(r'At exit called\.') is not None, 'atexit'
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class TestPythonBasic(TestControl):
|
||||
assert self.conf_get('applications/app/processes/spare') == 0, 'spare'
|
||||
|
||||
def test_python_get_listeners(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
assert self.conf_get()['listeners'] == {
|
||||
"*:7080": {"pass": "applications/app"}
|
||||
@@ -73,16 +73,20 @@ class TestPythonBasic(TestControl):
|
||||
}, 'listeners prefix 2'
|
||||
|
||||
def test_python_change_listener(self):
|
||||
self.conf(self.conf_basic)
|
||||
self.conf({"*:7081": {"pass": "applications/app"}}, 'listeners')
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(
|
||||
{"*:7081": {"pass": "applications/app"}}, 'listeners'
|
||||
)
|
||||
|
||||
assert self.conf_get('listeners') == {
|
||||
"*:7081": {"pass": "applications/app"}
|
||||
}, 'change listener'
|
||||
|
||||
def test_python_add_listener(self):
|
||||
self.conf(self.conf_basic)
|
||||
self.conf({"pass": "applications/app"}, 'listeners/*:7082')
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(
|
||||
{"pass": "applications/app"}, 'listeners/*:7082'
|
||||
)
|
||||
|
||||
assert self.conf_get('listeners') == {
|
||||
"*:7080": {"pass": "applications/app"},
|
||||
@@ -90,20 +94,20 @@ class TestPythonBasic(TestControl):
|
||||
}, 'add listener'
|
||||
|
||||
def test_python_change_application(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
self.conf('30', 'applications/app/processes/max')
|
||||
assert 'success' in self.conf('30', 'applications/app/processes/max')
|
||||
assert (
|
||||
self.conf_get('applications/app/processes/max') == 30
|
||||
), 'change application max'
|
||||
|
||||
self.conf('"/www"', 'applications/app/path')
|
||||
assert 'success' in self.conf('"/www"', 'applications/app/path')
|
||||
assert (
|
||||
self.conf_get('applications/app/path') == '/www'
|
||||
), 'change application path'
|
||||
|
||||
def test_python_delete(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
assert 'error' in self.conf_delete('applications/app')
|
||||
assert 'success' in self.conf_delete('listeners/*:7080')
|
||||
@@ -111,7 +115,7 @@ class TestPythonBasic(TestControl):
|
||||
assert 'error' in self.conf_delete('applications/app')
|
||||
|
||||
def test_python_delete_blocks(self):
|
||||
self.conf(self.conf_basic)
|
||||
assert 'success' in self.conf(self.conf_basic)
|
||||
|
||||
assert 'success' in self.conf_delete('listeners')
|
||||
assert 'success' in self.conf_delete('applications')
|
||||
|
||||
@@ -197,6 +197,6 @@ class TestPythonProcman(TestApplicationPython):
|
||||
), 'max zero'
|
||||
|
||||
def stop_all(self):
|
||||
self.conf({"listeners": {}, "applications": {}})
|
||||
assert 'success' in self.conf({"listeners": {}, "applications": {}})
|
||||
|
||||
assert len(self.pids_for_process()) == 0, 'stop all'
|
||||
|
||||
@@ -316,7 +316,7 @@ class TestRouting(TestApplicationProto):
|
||||
check_pass_error("%1", "%1")
|
||||
|
||||
def test_routes_absent(self):
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{
|
||||
"listeners": {"*:7081": {"pass": "applications/empty"}},
|
||||
"applications": {
|
||||
|
||||
@@ -217,7 +217,7 @@ class TestRubyApplication(TestApplicationRuby):
|
||||
|
||||
self.get()
|
||||
|
||||
self.conf({"listeners": {}, "applications": {}})
|
||||
assert 'success' in self.conf({"listeners": {}, "applications": {}})
|
||||
|
||||
assert (
|
||||
self.wait_for_record(r'\[error\].+At exit called\.') is not None
|
||||
|
||||
@@ -19,7 +19,7 @@ class TestTLS(TestApplicationTLS):
|
||||
return self.date_to_sec_epoch(date, '%b %d %H:%M:%S %Y %Z')
|
||||
|
||||
def add_tls(self, application='empty', cert='default', port=7080):
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{
|
||||
"pass": "applications/" + application,
|
||||
"tls": {"certificate": cert}
|
||||
@@ -28,7 +28,7 @@ class TestTLS(TestApplicationTLS):
|
||||
)
|
||||
|
||||
def remove_tls(self, application='empty', port=7080):
|
||||
self.conf(
|
||||
assert 'success' in self.conf(
|
||||
{"pass": "applications/" + application}, 'listeners/*:' + str(port)
|
||||
)
|
||||
|
||||
@@ -477,8 +477,10 @@ basicConstraints = critical,CA:TRUE"""
|
||||
read_timeout=1,
|
||||
)
|
||||
|
||||
self.conf({"pass": "applications/empty"}, 'listeners/*:7080')
|
||||
self.conf_delete('/certificates/default')
|
||||
assert 'success' in self.conf(
|
||||
{"pass": "applications/empty"}, 'listeners/*:7080'
|
||||
)
|
||||
assert 'success' in self.conf_delete('/certificates/default')
|
||||
|
||||
try:
|
||||
resp = self.get_ssl(
|
||||
@@ -508,7 +510,7 @@ basicConstraints = critical,CA:TRUE"""
|
||||
|
||||
self.certificate()
|
||||
|
||||
self.conf('1', 'applications/mirror/processes')
|
||||
assert 'success' in self.conf('1', 'applications/mirror/processes')
|
||||
|
||||
self.add_tls(application='mirror')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user