From 54837759f36eddb80af22c8d73e103a948221dc7 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Mon, 19 Oct 2020 22:25:29 +0100 Subject: Tests: fixed unit.log print. --- test/test_perl_application.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/test_perl_application.py') diff --git a/test/test_perl_application.py b/test/test_perl_application.py index 78e32a43..acd76626 100644 --- a/test/test_perl_application.py +++ b/test/test_perl_application.py @@ -3,6 +3,7 @@ import re import pytest from conftest import skip_alert +from conftest import unit_stop from unit.applications.lang.perl import TestApplicationPerl @@ -119,7 +120,7 @@ class TestPerlApplication(TestApplicationPerl): assert self.get()['body'] == '1', 'errors result' - self.stop() + unit_stop() assert ( self.wait_for_record(r'\[error\].+Error in application') -- cgit From fc9a012ceb83edc5511dccb55a90ea15ab52f337 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Thu, 5 Nov 2020 16:11:01 +0300 Subject: Tests: added Perl threading tests. --- test/test_perl_application.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'test/test_perl_application.py') diff --git a/test/test_perl_application.py b/test/test_perl_application.py index acd76626..78f2dd90 100644 --- a/test/test_perl_application.py +++ b/test/test_perl_application.py @@ -238,3 +238,44 @@ class TestPerlApplication(TestApplicationPerl): assert resp['status'] == 200, 'status' assert resp['body'] == 'Hello World!', 'body' + + def test_perl_application_threads(self): + self.load('threads') + + assert 'success' in self.conf( + '4', 'applications/threads/threads' + ), 'configure 4 threads' + + socks = [] + + for i in range(4): + (_, sock) = self.get( + headers={ + 'Host': 'localhost', + 'X-Delay': '2', + 'Connection': 'close', + }, + no_recv=True, + start=True, + ) + + socks.append(sock) + + threads = set() + + for sock in socks: + resp = self.recvall(sock).decode('utf-8') + + self.log_in(resp) + + resp = self._resp_to_dict(resp) + + assert resp['status'] == 200, 'status' + + threads.add(resp['headers']['X-Thread']) + + assert resp['headers']['Psgi-Multithread'] == '1', 'multithread' + + sock.close() + + assert len(socks) == len(threads), 'threads differs' -- cgit