From f5ac1432463e58873b2c801b6db64dbe4d0e8f1c Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Tue, 12 Jan 2021 06:20:23 +0000 Subject: Tests: unit_stop() removed where possible. Since wait_for_record() was introduced there is no need to stop Unit before parsing unit.log. --- test/test_php_application.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'test/test_php_application.py') diff --git a/test/test_php_application.py b/test/test_php_application.py index ad74faa8..9f0da531 100644 --- a/test/test_php_application.py +++ b/test/test_php_application.py @@ -2,10 +2,10 @@ import os import re import shutil import time +from subprocess import call import pytest -from conftest import unit_stop from unit.applications.lang.php import TestApplicationPHP from unit.option import option @@ -20,7 +20,7 @@ class TestPHPApplication(TestApplicationPHP): def set_opcache(self, app, val): assert 'success' in self.conf( - {"admin": {"opcache.enable": val, "opcache.enable_cli": val,},}, + {"admin": {"opcache.enable": val, "opcache.enable_cli": val}}, 'applications/' + app + '/options', ) @@ -99,7 +99,10 @@ class TestPHPApplication(TestApplicationPHP): assert self.get()['body'] == '0123' - unit_stop() + with open(temp_dir + '/unit.pid', 'r') as f: + pid = f.read().rstrip() + + call(['kill', '-s', 'USR1', pid]) with open(temp_dir + '/unit.log', 'r', errors='ignore') as f: errs = re.findall(r'Error in fastcgi_finish_request', f.read()) @@ -113,7 +116,10 @@ class TestPHPApplication(TestApplicationPHP): assert resp['status'] == 200 assert resp['body'] == '' - unit_stop() + with open(temp_dir + '/unit.pid', 'r') as f: + pid = f.read().rstrip() + + call(['kill', '-s', 'USR1', pid]) with open(temp_dir + '/unit.log', 'r', errors='ignore') as f: errs = re.findall(r'Error in fastcgi_finish_request', f.read()) @@ -538,8 +544,6 @@ class TestPHPApplication(TestApplicationPHP): assert self.get()['status'] == 200, 'status 2' - unit_stop() - pattern = r'\d{4}\/\d\d\/\d\d\s\d\d:.+\[notice\].+Error in application' assert self.wait_for_record(pattern) is not None, 'errors print' -- cgit