Skip to content

Commit 2b1d5f5

Browse files
committed
Better handle keyboard interrupt
A worker can be interrupted with SIGINT (by Ctrl+C) at the moment when a server (TarantoolServer, AppServer or UnittestServer) is not created. In this case test-run shows the following exception: | Process Process-21: | Traceback (most recent call last): | File "/usr/lib64/python2.7/multiprocessing/process.py", line 267, in _bootstrap | self.run() | File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run | self._target(*self._args, **self._kwargs) | File "/home/alex/projects/tarantool-meta/tarantool/test-run/dispatcher.py", line 378, in _run_worker | worker = self.gen_worker(worker_id) | File "/home/alex/projects/tarantool-meta/tarantool/test-run/lib/worker.py", line 243, in __init__ | self.stop_server(cleanup=False) | File "/home/alex/projects/tarantool-meta/tarantool/test-run/lib/worker.py", line 258, in stop_server | cleanup=cleanup) | File "/home/alex/projects/tarantool-meta/tarantool/test-run/lib/test_suite.py", line 182, in stop_server | server.stop(silent=silent) | AttributeError: 'NoneType' object has no attribute 'stop' The commit handles this case and the exception above will not occur anymore.
1 parent e8d6ac3 commit 2b1d5f5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/test_suite.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ def start_server(self, server):
179179
return inspector
180180

181181
def stop_server(self, server, inspector, silent=False, cleanup=True):
182-
server.stop(silent=silent)
182+
if server:
183+
server.stop(silent=silent)
184+
if inspector:
185+
inspector.stop()
183186
# don't delete core files or state of the data dir
184187
# in case of exception, which is raised when the
185188
# server crashes
186-
if inspector:
187-
inspector.stop()
188-
if cleanup:
189+
if cleanup and inspector:
189190
inspector.cleanup_nondefault()
191+
if cleanup and server:
190192
server.cleanup()
191193

192194
def run_test(self, test, server, inspector):

0 commit comments

Comments
 (0)