[Fix] test-utils: Allow expected server exits in canary tests (#45172)

This commit is contained in:
Shuwen Wang
2026-10-19 21:07:03 -07:00
committed by GitHub
parent 5b683d6b72
commit c53b98d1fe
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -2385,6 +2385,9 @@ def enter_scope(test_case, scope):
class CustomTestCase(unittest.TestCase):
# Fault-injection tests must inspect the failure after their server exits.
expect_server_exit = False
def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
@@ -2417,6 +2420,9 @@ class CustomTestCase(unittest.TestCase):
cls.setUpClass = classmethod(safe_setUpClass)
def _callTestMethod(self, method):
if self.expect_server_exit:
# Retrying would reuse the server that the test intentionally stopped.
return super()._callTestMethod(method)
max_retry = envs.SGLANG_TEST_MAX_RETRY.get()
if max_retry is None:
max_retry = 1 if is_in_ci() else 0