fix(ci): avoid killing flutter between test files
This commit is contained in:
+20
-25
@@ -39,14 +39,22 @@ jobs:
|
||||
import sys
|
||||
import time
|
||||
|
||||
tests = [
|
||||
test_paths = [
|
||||
'test/servicios/servicio_programacion_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'
|
||||
|
||||
def cleanup_process_group(pid):
|
||||
def kill_process_group(pid):
|
||||
if not use_process_group:
|
||||
return
|
||||
try:
|
||||
@@ -56,29 +64,16 @@ jobs:
|
||||
except ProcessLookupError:
|
||||
pass
|
||||
|
||||
for test_path in tests:
|
||||
cmd = [
|
||||
'flutter',
|
||||
'test',
|
||||
'--no-pub',
|
||||
'--concurrency=1',
|
||||
'--timeout=60s',
|
||||
'--reporter=expanded',
|
||||
test_path,
|
||||
]
|
||||
print('$ ' + ' '.join(cmd), flush=True)
|
||||
process = subprocess.Popen(cmd, start_new_session=use_process_group)
|
||||
try:
|
||||
returncode = process.wait(timeout=180)
|
||||
except subprocess.TimeoutExpired:
|
||||
print(f'ERROR: timeout ejecutando {test_path}', file=sys.stderr, flush=True)
|
||||
cleanup_process_group(process.pid)
|
||||
sys.exit(124)
|
||||
finally:
|
||||
cleanup_process_group(process.pid)
|
||||
print('$ ' + ' '.join(cmd), flush=True)
|
||||
process = subprocess.Popen(cmd, start_new_session=use_process_group)
|
||||
try:
|
||||
returncode = process.wait(timeout=240)
|
||||
except subprocess.TimeoutExpired:
|
||||
print('ERROR: timeout ejecutando tests críticos', file=sys.stderr, flush=True)
|
||||
kill_process_group(process.pid)
|
||||
sys.exit(124)
|
||||
|
||||
if returncode != 0:
|
||||
sys.exit(returncode)
|
||||
sys.exit(returncode)
|
||||
PY
|
||||
|
||||
- name: Limpiar procesos Flutter de tests
|
||||
|
||||
Reference in New Issue
Block a user