summaryrefslogtreecommitdiffhomepage
path: root/test/test_python_application.py
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-11-10 22:27:08 +0300
committerMax Romanov <max.romanov@nginx.com>2020-11-10 22:27:08 +0300
commita8a9d80f8dcff98a99c74a923a2a37b9e3e177eb (patch)
tree64cfd967bc30176255a25db2c1f91419ec940109 /test/test_python_application.py
parentb2771702fb6b9c7641b27f4fa1d68b9992dd5b28 (diff)
downloadunit-a8a9d80f8dcff98a99c74a923a2a37b9e3e177eb.tar.gz
unit-a8a9d80f8dcff98a99c74a923a2a37b9e3e177eb.tar.bz2
Tests: supporting instant app parameters in load().
Diffstat (limited to 'test/test_python_application.py')
-rw-r--r--test/test_python_application.py54
1 files changed, 11 insertions, 43 deletions
diff --git a/test/test_python_application.py b/test/test_python_application.py
index 780b836a..871d8bc0 100644
--- a/test/test_python_application.py
+++ b/test/test_python_application.py
@@ -197,11 +197,6 @@ custom-header: BLAH
assert resp['body'] == body, 'keep-alive 2'
def test_python_keepalive_reconfigure(self):
- skip_alert(
- r'pthread_mutex.+failed',
- r'failed to apply',
- r'process \d+ exited on signal',
- )
self.load('mirror')
assert self.get()['status'] == 200, 'init'
@@ -223,9 +218,8 @@ custom-header: BLAH
)
assert resp['body'] == body, 'keep-alive open'
- assert 'success' in self.conf(
- str(i + 1), 'applications/mirror/processes'
- ), 'reconfigure'
+
+ self.load('mirror', processes=i + 1)
socks.append(sock)
@@ -243,9 +237,8 @@ custom-header: BLAH
)
assert resp['body'] == body, 'keep-alive request'
- assert 'success' in self.conf(
- str(i + 1), 'applications/mirror/processes'
- ), 'reconfigure 2'
+
+ self.load('mirror', processes=i + 1)
for i in range(conns):
resp = self.post(
@@ -259,9 +252,8 @@ custom-header: BLAH
)
assert resp['body'] == body, 'keep-alive close'
- assert 'success' in self.conf(
- str(i + 1), 'applications/mirror/processes'
- ), 'reconfigure 3'
+
+ self.load('mirror', processes=i + 1)
def test_python_keepalive_reconfigure_2(self):
self.load('mirror')
@@ -351,11 +343,7 @@ Connection: close
assert self.wait_for_record(r'At exit called\.') is not None, 'atexit'
def test_python_process_switch(self):
- self.load('delayed')
-
- assert 'success' in self.conf(
- '2', 'applications/delayed/processes'
- ), 'configure 2 processes'
+ self.load('delayed', processes=2)
self.get(
headers={
@@ -541,9 +529,7 @@ last line: 987654321
def test_python_application_loading_error(self):
skip_alert(r'Python failed to import module "blah"')
- self.load('empty')
-
- assert 'success' in self.conf('"blah"', 'applications/empty/module')
+ self.load('empty', module="blah")
assert self.get()['status'] == 503, 'loading error'
@@ -811,34 +797,16 @@ last line: 987654321
assert self.get()['status'] == 204, 'default application response'
- assert 'success' in self.conf(
- '"app"', 'applications/callable/callable'
- )
+ self.load('callable', callable="app")
assert self.get()['status'] == 200, 'callable response'
- assert 'success' in self.conf(
- '"blah"', 'applications/callable/callable'
- )
+ self.load('callable', callable="blah")
assert self.get()['status'] not in [200, 204], 'callable response inv'
- assert 'success' in self.conf(
- '"app"', 'applications/callable/callable'
- )
-
- assert self.get()['status'] == 200, 'callable response 2'
-
- assert 'success' in self.conf_delete('applications/callable/callable')
-
- assert self.get()['status'] == 204, 'default response 2'
-
def test_python_application_threads(self):
- self.load('threads')
-
- assert 'success' in self.conf(
- '4', 'applications/threads/threads'
- ), 'configure 4 threads'
+ self.load('threads', threads=4)
socks = []