test: recover the config-namespace-migration deferrals (#33171)

The module-skipped tests injected config by faking get_server_args (a
SimpleNamespace stand-in patched onto the module) or by writing fields
onto a ServerArgs instance post-publish — both invisible to the namespace
accessors the production code now reads. Re-enable them by publishing the
config they need (get_context().override_server_args seeding, scoped per
test), asserting bag state where the old assertions checked instance
write-through (declare_load_time_override is bag-only), and extending the
per-runner stubs the code genuinely reads (kv_cache_dtype_str,
max_total_tokens, context_len).

The unified-radix-cache file (which grew a large hicache/insert-walk suite
while skipped) is recovered in the same change:

- test_cache_finished_req_strips_thinking (19 parametrized classes) wrote
  strip_thinking_cache onto the ServerArgs instance; the cache reads
  get_serving().strip_thinking_cache — use the serving bag's scoped
  override.
- test_shallower_crossing_backs_up_above_backuped_middle staged its
  broken-backup-continuity setup through insert_host, which now
  deliberately drops refills below an un-backed-up node under
  write-through (host_insert_dropped). Build the same tree state through
  an explicit backup + device eviction.

Every config-namespace-migration deferral is recovered, so the deferral
ratchet (test_migration_deferral_ratchet.py) has done its job and is
retired.
This commit is contained in:
Cheng Wan
2026-08-01 08:59:27 -07:00
committed by GitHub
parent 47d8b5b749
commit 9b44695713
16 changed files with 127 additions and 386 deletions
@@ -13,6 +13,7 @@ from unittest.mock import MagicMock, patch
import torch
from sglang.srt.model_executor.forward_batch_info import ForwardMode
from sglang.srt.runtime_context import get_context
from sglang.srt.speculative.adaptive_runtime_state import SpecRuntimeState
from sglang.srt.speculative.eagle_utils import organize_draft_results
from sglang.srt.speculative.eagle_worker_v2 import EagleDraftWorker, EAGLEWorkerV2
@@ -26,20 +27,6 @@ from sglang.test.test_utils import CustomTestCase
register_cuda_ci(est_time=20, stage="base-b", runner_config="1-gpu-small")
register_amd_ci(est_time=20, stage="stage-b", runner_config="1-gpu-small-amd")
import pytest as _pytest_defer
_DEFER_REASON = (
"Temporarily skipped during the ServerArgs config-namespace migration; "
"re-enabled once the runtime-config accessor API stabilizes."
)
pytestmark = _pytest_defer.mark.skip(reason=_DEFER_REASON)
def setUpModule():
import unittest
raise unittest.SkipTest(_DEFER_REASON)
register_cpu_ci(est_time=20, suite="base-a-test-cpu")
@@ -109,6 +96,15 @@ def _make_backend_factory(decode_backend, draft_extend_backend, captured_kwargs=
class TestEagleWorkerV2Topk1FastPath(CustomTestCase):
def setUp(self):
# _rebuild_topk1_chain_buffers sizes its preallocation from the
# published config: get_exec().graph.cuda_graph_config stays None on
# the dummy-boundary publish (no resolution), so
# get_schedule().max_running_requests alone sizes the buffers.
override = get_context().override_server_args(max_running_requests=8)
override.install()
self.addCleanup(override.restore)
def test_fast_path_matches_slow_path(self):
bs = 3
for num_steps in (1, 2, 3, 4):
@@ -145,6 +141,13 @@ class TestEagleWorkerV2Topk1FastPath(CustomTestCase):
class TestEagleWorkerV2BackendFallback(CustomTestCase):
def setUp(self):
# The adaptive state-machine paths write live spec switches through
# get_context().override, which needs a published config.
override = get_context().override_server_args()
override.install()
self.addCleanup(override.restore)
def test_missing_seed_cuda_graph_fallback(self):
graph_result = (
[],