fix(ci): avoid killing flutter between test files
This commit is contained in:
+14
-19
@@ -39,14 +39,22 @@ jobs:
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
tests = [
|
test_paths = [
|
||||||
'test/servicios/servicio_programacion_alarmas_test.dart',
|
'test/servicios/servicio_programacion_alarmas_test.dart',
|
||||||
'test/estado/estado_alarmas_test.dart',
|
'test/estado/estado_alarmas_test.dart',
|
||||||
]
|
]
|
||||||
|
cmd = [
|
||||||
|
'flutter',
|
||||||
|
'test',
|
||||||
|
'--no-pub',
|
||||||
|
'--concurrency=1',
|
||||||
|
'--timeout=60s',
|
||||||
|
'--reporter=expanded',
|
||||||
|
*test_paths,
|
||||||
|
]
|
||||||
use_process_group = hasattr(os, 'killpg') and os.name != 'nt'
|
use_process_group = hasattr(os, 'killpg') and os.name != 'nt'
|
||||||
|
|
||||||
def cleanup_process_group(pid):
|
def kill_process_group(pid):
|
||||||
if not use_process_group:
|
if not use_process_group:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
@@ -56,28 +64,15 @@ jobs:
|
|||||||
except ProcessLookupError:
|
except ProcessLookupError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for test_path in tests:
|
|
||||||
cmd = [
|
|
||||||
'flutter',
|
|
||||||
'test',
|
|
||||||
'--no-pub',
|
|
||||||
'--concurrency=1',
|
|
||||||
'--timeout=60s',
|
|
||||||
'--reporter=expanded',
|
|
||||||
test_path,
|
|
||||||
]
|
|
||||||
print('$ ' + ' '.join(cmd), flush=True)
|
print('$ ' + ' '.join(cmd), flush=True)
|
||||||
process = subprocess.Popen(cmd, start_new_session=use_process_group)
|
process = subprocess.Popen(cmd, start_new_session=use_process_group)
|
||||||
try:
|
try:
|
||||||
returncode = process.wait(timeout=180)
|
returncode = process.wait(timeout=240)
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
print(f'ERROR: timeout ejecutando {test_path}', file=sys.stderr, flush=True)
|
print('ERROR: timeout ejecutando tests críticos', file=sys.stderr, flush=True)
|
||||||
cleanup_process_group(process.pid)
|
kill_process_group(process.pid)
|
||||||
sys.exit(124)
|
sys.exit(124)
|
||||||
finally:
|
|
||||||
cleanup_process_group(process.pid)
|
|
||||||
|
|
||||||
if returncode != 0:
|
|
||||||
sys.exit(returncode)
|
sys.exit(returncode)
|
||||||
PY
|
PY
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user