3
3
import functools
4
4
import os
5
5
import signal
6
+ import textwrap
6
7
import traceback
7
8
import yaml
8
9
from datetime import datetime
9
10
10
11
from lib import Options
12
+ from lib .colorer import qa_notice
11
13
from lib .colorer import color_log
12
14
from lib .colorer import color_stdout
13
15
from lib .tarantool_server import TarantoolServer
@@ -143,17 +145,15 @@ class WorkerTaskResult(BaseWorkerMessage):
143
145
""" Passed into the result queue when a task processed (done) by the
144
146
worker. The short_status (string) field intended to give short note whether
145
147
the task processed successfully or not, but with little more flexibility
146
- than binary True/False. The result_checksum (string) field saves the results
147
- file checksum on test fail. The task_id (any hashable object) field hold ID of
148
+ than binary True/False. The task_id (any hashable object) field hold ID of
148
149
the processed task. The is_long (boolean) field shows if task is in long test
149
150
list in suite.ini. The duration (float) field saves the task run time. The
150
151
show_reproduce_content configuration from suite.ini.
151
152
"""
152
153
def __init__ (self , worker_id , worker_name , task_id ,
153
- short_status , result_checksum , is_long , duration , show_reproduce_content ):
154
+ short_status , is_long , duration , show_reproduce_content ):
154
155
super (WorkerTaskResult , self ).__init__ (worker_id , worker_name )
155
156
self .short_status = short_status
156
- self .result_checksum = result_checksum
157
157
self .task_id = task_id
158
158
self .is_long = is_long
159
159
self .duration = duration
@@ -222,9 +222,8 @@ def current_task(self, task_id):
222
222
return WorkerCurrentTask (self .id , self .name , task_name , task_param ,
223
223
task_result , task_tmp_result )
224
224
225
- def wrap_result (self , task_id , short_status , result_checksum , duration ):
225
+ def wrap_result (self , task_id , short_status , duration ):
226
226
return WorkerTaskResult (self .id , self .name , task_id , short_status ,
227
- result_checksum ,
228
227
self .suite .test_is_long (task_id ), duration ,
229
228
self .suite .show_reproduce_content ())
230
229
@@ -317,7 +316,7 @@ def run_task(self, task_id):
317
316
with open (self .reproduce_file , 'a' ) as f :
318
317
task_id_str = yaml .safe_dump (task .id , default_flow_style = True )
319
318
f .write ('- ' + task_id_str )
320
- short_status , result_checksum , duration = self .suite .run_test (
319
+ short_status , duration = self .suite .run_test (
321
320
task , self .server , self .inspector )
322
321
except KeyboardInterrupt :
323
322
self .report_keyboard_interrupt ()
@@ -327,7 +326,7 @@ def run_task(self, task_id):
327
326
'\n Worker "%s" received the following error; stopping...\n '
328
327
% self .name + traceback .format_exc () + '\n ' , schema = 'error' )
329
328
raise
330
- return short_status , result_checksum , duration
329
+ return short_status , duration
331
330
332
331
def run_loop (self , task_queue , result_queue ):
333
332
""" called from 'run_all' """
@@ -342,11 +341,15 @@ def run_loop(self, task_queue, result_queue):
342
341
break
343
342
344
343
short_status = None
345
- result_checksum = None
346
344
duration = 0.0
347
345
result_queue .put (self .current_task (task_id ))
348
346
testname = os .path .basename (task_id [0 ])
349
- fragile_checksums = self .suite .get_test_fragile_checksums (testname )
347
+ if self .suite .fragile ['tests' ].get (testname , {}).get ('checksums' ):
348
+ qa_notice (
349
+ textwrap .fill ('Test "%s" from "fragile" list has checksums '
350
+ 'defined in suite.ini but this functionality '
351
+ 'is dropped' % testname )
352
+ )
350
353
retries_left = self .suite .fragile_retries ()
351
354
# let's run till short_status became 'pass'
352
355
while short_status != 'pass' and retries_left >= 0 :
@@ -355,18 +358,15 @@ def run_loop(self, task_queue, result_queue):
355
358
if short_status == 'fail' :
356
359
color_stdout (
357
360
'Test "%s", conf: "%s"\n '
358
- '\t from "fragile" list failed with results'
359
- ' file checksum: "%s", rerunning ...\n '
360
- % (task_id [0 ], task_id [1 ], result_checksum ), schema = 'error' )
361
+ '\t from "fragile" list failed, rerunning ...\n '
362
+ % (task_id [0 ], task_id [1 ]), schema = 'error' )
361
363
# run task and save the result to short_status
362
- short_status , result_checksum , duration = self .run_task (task_id )
363
- # check if the results file checksum set on fail and if
364
- # the newly created results file is known by checksum
365
- if not result_checksum or (result_checksum not in fragile_checksums ):
364
+ short_status , duration = self .run_task (task_id )
365
+ if testname not in self .suite .fragile ['tests' ]:
366
366
break
367
367
retries_left = retries_left - 1
368
368
369
- result_queue .put (self .wrap_result (task_id , short_status , result_checksum , duration ))
369
+ result_queue .put (self .wrap_result (task_id , short_status , duration ))
370
370
if short_status == 'fail' :
371
371
if Options ().args .is_force :
372
372
self .restart_server ()
0 commit comments