summaryrefslogtreecommitdiffhomepage
path: root/test/conftest.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2021-11-04 13:05:53 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2021-11-04 13:05:53 +0000
commitbc95fcc324dc55d07547ccb85389465e5db70d68 (patch)
treec8813727e8df1514cdf295afec696042867dfaff /test/conftest.py
parent2359c4056c38bfb10569ec03da895c8e6e9dfbd2 (diff)
downloadunit-bc95fcc324dc55d07547ccb85389465e5db70d68.tar.gz
unit-bc95fcc324dc55d07547ccb85389465e5db70d68.tar.bz2
Tests: added migration test for "share".
Diffstat (limited to 'test/conftest.py')
-rw-r--r--test/conftest.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/conftest.py b/test/conftest.py
index 36061f8c..689c857a 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -356,7 +356,7 @@ def run(request):
_check_alerts(log=log)
-def unit_run():
+def unit_run(state_dir=None):
global unit_instance
if not option.restart and 'unitd' in unit_instance:
@@ -374,7 +374,9 @@ def unit_run():
if oct(stat.S_IMODE(os.stat(build_dir).st_mode)) != '0o777':
public_dir(build_dir)
- os.mkdir(temp_dir + '/state')
+ state = temp_dir + '/state' if state_dir is None else state_dir
+ if not os.path.isdir(state):
+ os.mkdir(state)
unitd_args = [
unitd,
@@ -382,7 +384,7 @@ def unit_run():
'--modules',
build_dir,
'--state',
- temp_dir + '/state',
+ state,
'--pid',
temp_dir + '/unit.pid',
'--log',
@@ -414,7 +416,8 @@ def unit_run():
with open(temp_dir + '/unit.pid', 'r') as f:
unit_instance['pid'] = f.read().rstrip()
- _clear_conf(unit_instance['temp_dir'] + '/control.unit.sock')
+ if state_dir is None:
+ _clear_conf(unit_instance['temp_dir'] + '/control.unit.sock')
_fds_info['main']['fds'] = _count_fds(unit_instance['pid'])