[Bugfix] Validate --stage-overrides shape in parse_stage_overrides (drop field allowlist) (#6230)
Signed-off-by: Chiquan Mo <mcigggg399026@gmail.com> Signed-off-by: MciG-ggg <MciG-ggg@users.noreply.github.com> Co-authored-by: MciG-ggg <MciG-ggg@users.noreply.github.com>
This commit is contained in:
1 parent
d1a5a7c178
commit
2b47faf601
3 files changed
+137
-6
No files matched your search
@@ -3,6 +3,7 @@
|
||||
|
||||
"""Unit tests for vllm_omni.entrypoints.utils module."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
from collections import Counter
|
||||
from dataclasses import dataclass
|
||||
@@ -255,8 +256,12 @@ class TestFilterDataclassKwargs:
|
||||
with pytest.raises(ValueError, match="kwargs must be a dictionary"):
|
||||
filter_dataclass_kwargs(SimpleConfig, "invalid")
|
||||
|
||||
def test_filters_omni_engine_args_unknown_fields(self):
|
||||
"""Test that OmniEngineArgs kwargs are filtered to valid fields only."""
|
||||
def test_filters_omni_engine_args_unknown_fields(self, caplog):
|
||||
"""Test that OmniEngineArgs kwargs are filtered to valid fields only,
|
||||
and that the WARNING contract fires for every drop — the affordance
|
||||
that lets a ``--stage-overrides`` typo (``{"0":{"kv_cache_dtpye":...}}``)
|
||||
surface in the log rather than being silently misapplied downstream.
|
||||
"""
|
||||
kwargs = {
|
||||
"model": "dummy",
|
||||
"stage_id": 1,
|
||||
@@ -264,12 +269,16 @@ class TestFilterDataclassKwargs:
|
||||
"unknown_field": "drop_me",
|
||||
}
|
||||
|
||||
result = filter_dataclass_kwargs(OmniEngineArgs, kwargs)
|
||||
with caplog.at_level(logging.WARNING, logger="vllm_omni.entrypoints.utils"):
|
||||
result = filter_dataclass_kwargs(OmniEngineArgs, kwargs)
|
||||
|
||||
assert "model" in result
|
||||
assert "stage_id" in result
|
||||
assert "engine_output_type" in result
|
||||
assert "unknown_field" not in result
|
||||
assert any(rec.levelno == logging.WARNING and "unknown_field" in rec.message for rec in caplog.records), (
|
||||
f"expected WARNING naming 'unknown_field'; got {[r.message for r in caplog.records]}"
|
||||
)
|
||||
|
||||
def test_filters_omni_diffusion_config_union_dataclass(self):
|
||||
"""Test that OmniDiffusionConfig filters nested dataclass in Union fields."""
|
||||
|
||||
Reference in new issue
Block a user