[CI] test-utils: Abort the test run when its server dies inside a CustomTestCase method (#45053)

This commit is contained in:
Liangsheng Yin
2026-10-18 18:00:06 -07:00
committed by GitHub
parent 329072d99a
commit 299da60131
+16 -3
View File
@@ -2420,10 +2420,23 @@ class CustomTestCase(unittest.TestCase):
max_retry = envs.SGLANG_TEST_MAX_RETRY.get()
if max_retry is None:
max_retry = 1 if is_in_ci() else 0
retry(
lambda: super(CustomTestCase, self)._callTestMethod(method),
max_retry=max_retry,
# A server that dies mid-method fails every later request; abort the
# run rather than let clients back off and the method retry against it.
# Teardown kills the server only after this window closes.
process = getattr(self, "process", None)
stop = (
start_subprocess_fail_fast_watcher([("server", process)])
if isinstance(process, subprocess.Popen)
else None
)
try:
retry(
lambda: super(CustomTestCase, self)._callTestMethod(method),
max_retry=max_retry,
)
finally:
if stop is not None:
stop.set()
def setUp(self):
print(