Introduce server_fixtures in sglang.test (#14899)

This commit is contained in:
Liangsheng Yin
2025-12-11 22:30:33 +09:00
committed by GitHub
parent 27032cecd9
commit 543d62d11a
9 changed files with 36 additions and 22 deletions
@@ -19,7 +19,7 @@ from sglang.test.test_utils import (
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class TestDisaggregationBase(CustomTestCase): class PDDisaggregationServerBase(CustomTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
parsed_url = urlparse(DEFAULT_URL_FOR_TEST) parsed_url = urlparse(DEFAULT_URL_FOR_TEST)
+1 -1
View File
@@ -3,7 +3,7 @@ from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree from sglang.srt.utils import kill_process_tree
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_disaggregation_utils import get_rdma_devices_args from sglang.test.server_fixtures.disaggregation_fixture import get_rdma_devices_args
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST_MLA, DEFAULT_MODEL_NAME_FOR_TEST_MLA,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
@@ -8,7 +8,9 @@ from typing import Dict
import requests import requests
from sglang.bench_serving import get_tokenizer from sglang.bench_serving import get_tokenizer
from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST, DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
@@ -16,7 +18,7 @@ from sglang.test.test_utils import (
) )
class DisaggregationHiCacheBase(TestDisaggregationBase): class DisaggregationHiCacheBase(PDDisaggregationServerBase):
"""Base class for disaggregation with HiCache tests""" """Base class for disaggregation with HiCache tests"""
@classmethod @classmethod
@@ -2,7 +2,9 @@ import unittest
from types import SimpleNamespace from types import SimpleNamespace
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST, DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
@@ -10,7 +12,7 @@ from sglang.test.test_utils import (
) )
class TestDisaggregationPiecewiseCudaGraph(TestDisaggregationBase): class TestDisaggregationPiecewiseCudaGraph(PDDisaggregationServerBase):
"""Test piecewise CUDA graph support in disaggregation prefill server""" """Test piecewise CUDA graph support in disaggregation prefill server"""
@classmethod @classmethod
+7 -5
View File
@@ -8,7 +8,9 @@ import requests
from transformers import AutoTokenizer from transformers import AutoTokenizer
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_EAGLE_DRAFT_MODEL_FOR_TEST, DEFAULT_EAGLE_DRAFT_MODEL_FOR_TEST,
DEFAULT_EAGLE_TARGET_MODEL_FOR_TEST, DEFAULT_EAGLE_TARGET_MODEL_FOR_TEST,
@@ -18,7 +20,7 @@ from sglang.test.test_utils import (
) )
class TestDisaggregationAccuracy(TestDisaggregationBase): class TestDisaggregationAccuracy(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
@@ -185,7 +187,7 @@ class TestDisaggregationAccuracy(TestDisaggregationBase):
) )
class TestDisaggregationMooncakeFailure(TestDisaggregationBase): class TestDisaggregationMooncakeFailure(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
@@ -273,7 +275,7 @@ class TestDisaggregationMooncakeFailure(TestDisaggregationBase):
raise e from health_check_error raise e from health_check_error
class TestDisaggregationMooncakeSpec(TestDisaggregationBase): class TestDisaggregationMooncakeSpec(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
@@ -358,7 +360,7 @@ class TestDisaggregationMooncakeSpec(TestDisaggregationBase):
self.assertGreater(metrics["accuracy"], 0.20) self.assertGreater(metrics["accuracy"], 0.20)
class TestDisaggregationSimulatedRetract(TestDisaggregationBase): class TestDisaggregationSimulatedRetract(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
+7 -5
View File
@@ -3,7 +3,9 @@ from types import SimpleNamespace
from sglang.srt.environ import envs from sglang.srt.environ import envs
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST, DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_MODEL_NAME_FOR_TEST_MLA, DEFAULT_MODEL_NAME_FOR_TEST_MLA,
@@ -13,7 +15,7 @@ from sglang.test.test_utils import (
) )
class TestDisaggregationMooncakePrefillLargerTP(TestDisaggregationBase): class TestDisaggregationMooncakePrefillLargerTP(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
@@ -84,7 +86,7 @@ class TestDisaggregationMooncakePrefillLargerTP(TestDisaggregationBase):
self.assertGreater(metrics["accuracy"], 0.60) self.assertGreater(metrics["accuracy"], 0.60)
class TestDisaggregationMooncakeDecodeLargerTP(TestDisaggregationBase): class TestDisaggregationMooncakeDecodeLargerTP(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
@@ -155,7 +157,7 @@ class TestDisaggregationMooncakeDecodeLargerTP(TestDisaggregationBase):
self.assertGreater(metrics["accuracy"], 0.60) self.assertGreater(metrics["accuracy"], 0.60)
class TestDisaggregationMooncakeMHAPrefillLargerTP(TestDisaggregationBase): class TestDisaggregationMooncakeMHAPrefillLargerTP(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
@@ -226,7 +228,7 @@ class TestDisaggregationMooncakeMHAPrefillLargerTP(TestDisaggregationBase):
self.assertGreater(metrics["accuracy"], 0.60) self.assertGreater(metrics["accuracy"], 0.60)
class TestDisaggregationMooncakeMHADecodeLargerTP(TestDisaggregationBase): class TestDisaggregationMooncakeMHADecodeLargerTP(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
+4 -2
View File
@@ -3,7 +3,9 @@ from types import SimpleNamespace
from sglang.srt.environ import envs from sglang.srt.environ import envs
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST_MLA, DEFAULT_MODEL_NAME_FOR_TEST_MLA,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
@@ -12,7 +14,7 @@ from sglang.test.test_utils import (
) )
class TestDisaggregationDPAttention(TestDisaggregationBase): class TestDisaggregationDPAttention(PDDisaggregationServerBase):
PREFILL_DP_SIZE = 4 PREFILL_DP_SIZE = 4
DECODE_DP_SIZE = 4 DECODE_DP_SIZE = 4
@@ -2,14 +2,16 @@ import unittest
from types import SimpleNamespace from types import SimpleNamespace
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
popen_launch_pd_server, popen_launch_pd_server,
) )
class TestDisaggregationHybridAttentionMamba(TestDisaggregationBase): class TestDisaggregationHybridAttentionMamba(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
+4 -2
View File
@@ -3,7 +3,9 @@ import unittest
from types import SimpleNamespace from types import SimpleNamespace
from sglang.test.few_shot_gsm8k import run_eval from sglang.test.few_shot_gsm8k import run_eval
from sglang.test.test_disaggregation_utils import TestDisaggregationBase from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import ( from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST, DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH, DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
@@ -12,7 +14,7 @@ from sglang.test.test_utils import (
) )
class TestDisaggregationPPAccuracy(TestDisaggregationBase): class TestDisaggregationPPAccuracy(PDDisaggregationServerBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()