Skip to content

Commit a641da8

Browse files
alec-flowersclaude
andcommitted
test: add tests for aiperf_args passthrough in trace-replay
Tests that key-value args are passed as --key value flags and boolean args are passed as --flag (true) or omitted (false). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 852a19c commit a641da8

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

tests/test_benchmarks.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,81 @@ def test_build_command_default_thresholds(self):
322322
assert cmd[6] == "2000" # default ttft
323323
assert cmd[7] == "25" # default itl
324324

325+
def test_build_command_with_aiperf_args(self):
326+
"""aiperf_args are passed through as CLI flags."""
327+
from unittest.mock import MagicMock
328+
329+
from srtctl.benchmarks.trace_replay import TraceReplayRunner
330+
331+
runner = TraceReplayRunner()
332+
runtime = MagicMock()
333+
runtime.frontend_port = 8000
334+
runtime.is_hf_model = False
335+
336+
from srtctl.core.schema import BenchmarkConfig, ModelConfig, ResourceConfig, SrtConfig
337+
338+
config = SrtConfig(
339+
name="test",
340+
model=ModelConfig(path="/model/kimi", container="/image", precision="fp4"),
341+
resources=ResourceConfig(gpu_type="gb200"),
342+
benchmark=BenchmarkConfig(
343+
type="trace-replay",
344+
trace_file="/traces/dataset.jsonl",
345+
concurrencies=[4],
346+
aiperf_args={
347+
"benchmark-duration": 600,
348+
"workers-max": 200,
349+
"request-timeout-seconds": 1200,
350+
"profile-export-level": "raw",
351+
},
352+
),
353+
)
354+
355+
cmd = runner.build_command(config, runtime)
356+
357+
# Positional args come first (9 of them)
358+
assert cmd[8] == "/model" # tokenizer path
359+
360+
# aiperf_args appended after positional args
361+
extra = cmd[9:]
362+
assert "--benchmark-duration" in extra
363+
assert extra[extra.index("--benchmark-duration") + 1] == "600"
364+
assert "--workers-max" in extra
365+
assert extra[extra.index("--workers-max") + 1] == "200"
366+
assert "--request-timeout-seconds" in extra
367+
assert "--profile-export-level" in extra
368+
assert extra[extra.index("--profile-export-level") + 1] == "raw"
369+
370+
def test_build_command_aiperf_args_bool(self):
371+
"""Boolean aiperf_args are passed as flags without values."""
372+
from unittest.mock import MagicMock
373+
374+
from srtctl.benchmarks.trace_replay import TraceReplayRunner
375+
376+
runner = TraceReplayRunner()
377+
runtime = MagicMock()
378+
runtime.frontend_port = 8000
379+
runtime.is_hf_model = False
380+
381+
from srtctl.core.schema import BenchmarkConfig, ModelConfig, ResourceConfig, SrtConfig
382+
383+
config = SrtConfig(
384+
name="test",
385+
model=ModelConfig(path="/model/test", container="/image", precision="fp4"),
386+
resources=ResourceConfig(gpu_type="gb200"),
387+
benchmark=BenchmarkConfig(
388+
type="trace-replay",
389+
trace_file="/traces/dataset.jsonl",
390+
concurrencies=[1],
391+
aiperf_args={"export-http-trace": True, "disabled-flag": False},
392+
),
393+
)
394+
395+
cmd = runner.build_command(config, runtime)
396+
extra = cmd[9:]
397+
assert "--export-http-trace" in extra
398+
assert "--disabled-flag" not in extra
399+
325400
def test_config_roundtrip(self):
326401
"""Config with trace-replay loads correctly from YAML."""
327402
import tempfile

0 commit comments

Comments
 (0)