Skip to content

Commit 08a4817

Browse files
committed
Don't reset no-output timer on irrelevant events
The idea of this timer is to stop testing if nothing is written to the terminal for a long time (120 seconds by default). Before this commit, the timer reset on any event: say, when an entry is written to a test-run log file. It is counter-intuitive and sometimes may look like the timer just does not work. Let's consider the following snippet of a test code: | -- Wait until <cmd> on instance 'foo' will return | -- an expected value. | local cmd = <...> | local exp = <...> | while true do \ | local res = test_run:eval('foo', cmd)[1] \ | if res == exp then \ | break \ | end \ | end After commit 'logging: trace test-run commands and responses' we log test-run commands and so the snippet would discard the no-output timer at all. If something going wrong and the <cmd> command will never return the expected result, the loop will spin infinitely. After this commit, the logging events will not reset the timer and so the testing will be finished eventually (after 120 seconds without output to the terminal). However if --debug is passed, the logging events will be printed on the terminal and will reset the timer. It looks logical, because the timer is about the printed messages, but it means that the behaviour of the testing system may depend on whether the --debug option is passed. Don't know whether behaviour would be better, so implemented the most intuitive one. Part of activities around [1]. [1]: https://github.com/tarantool/tarantool/issues/5395
1 parent f5ceb6a commit 08a4817

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

listeners.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,21 @@ def __init__(self, get_not_done_worker_ids, kill_all_workers,
258258
self.worker_current_task = dict()
259259

260260
def process_result(self, obj):
261-
self.warned_seconds_ago = 0.0
262-
self.inactivity = 0.0
263-
261+
# Track tasks in progress.
264262
if isinstance(obj, WorkerCurrentTask):
265263
self.worker_current_task[obj.worker_id] = obj
266264

265+
# Skip irrelevant events.
266+
if not isinstance(obj, WorkerOutput):
267+
return
268+
269+
# Skip color_log() events if --debug is not passed.
270+
if obj.log_only and not lib.Options().args.debug:
271+
return
272+
273+
self.warned_seconds_ago = 0.0
274+
self.inactivity = 0.0
275+
267276
def process_timeout(self, delta_seconds):
268277
self.warned_seconds_ago += delta_seconds
269278
self.inactivity += delta_seconds

0 commit comments

Comments
 (0)