[Fix] test-utils: Allow expected server exits in canary tests (#45172)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user