Skip to content

Commit b967dad

Browse files
fix: E2E tests
Signed-off-by: Alon Kellner <[email protected]>
1 parent b5ba4b0 commit b967dad

File tree

3 files changed

+56
-4
lines changed

3 files changed

+56
-4
lines changed

src/guidellm/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,10 @@ def benchmark():
388388
"--detect-saturation", # alias
389389
default=None,
390390
help=(
391-
"Enable over-saturation detection. Can be a flag (bool) or a JSON dict with "
392-
'configuration (e.g., \'{"enabled": true, "min_seconds": 30}\'). '
391+
"Enable over-saturation detection. "
392+
"Use --over-saturation=True for boolean flag, "
393+
"or a JSON dict with configuration "
394+
'(e.g., \'{"enabled": true, "min_seconds": 30}\'). '
393395
"Defaults to None (disabled)."
394396
),
395397
type=click.UNPROCESSED,

tests/e2e/test_over_saturated_benchmark.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,50 @@ def test_over_saturated_benchmark(server: VllmSimServer):
7272
)
7373

7474
cleanup_report_file(report_path)
75+
76+
77+
@pytest.mark.timeout(60)
78+
def test_over_saturated_benchmark_with_dict_config(server: VllmSimServer):
79+
"""
80+
Test over-saturation detection with dictionary configuration instead of boolean.
81+
"""
82+
report_path = Path("tests/e2e/over_saturated_benchmarks_dict.json")
83+
rate = 100
84+
85+
# Create and configure the guidellm client
86+
client = GuidellmClient(target=server.get_url(), output_path=report_path)
87+
88+
cleanup_report_file(report_path)
89+
# Start the benchmark with dictionary configuration for over-saturation
90+
client.start_benchmark(
91+
rate=rate,
92+
max_seconds=20,
93+
over_saturation={
94+
"enabled": True,
95+
"min_seconds": 0,
96+
"max_window_seconds": 120.0,
97+
"moe_threshold": 2.0,
98+
"minimum_window_size": 5,
99+
},
100+
extra_env={
101+
"GUIDELLM__CONSTRAINT_OVER_SATURATION_MIN_SECONDS": "0",
102+
"GOMAXPROCS": "1",
103+
},
104+
)
105+
106+
# Wait for the benchmark to complete
107+
client.wait_for_completion(timeout=55)
108+
109+
# Assert no Python exceptions occurred
110+
assert_no_python_exceptions(client.stderr)
111+
112+
# Load and validate the report
113+
report = load_benchmark_report(report_path)
114+
benchmark = report["benchmarks"][0]
115+
116+
# Check that the over-saturation constraint was triggered
117+
assert_constraint_triggered(
118+
benchmark, "over_saturation", {"is_over_saturated": True}
119+
)
120+
121+
cleanup_report_file(report_path)

tests/e2e/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,18 @@ def start_benchmark(
5454
"""
5555
Start a guidellm benchmark command.
5656
57-
:param rate_type: Type of rate control (constant, etc.)
57+
:param profile: Type of rate control (constant, etc.)
5858
:param rate: Request rate
5959
:param max_seconds: Maximum duration in seconds
6060
:param max_requests: Maximum number of requests
6161
:param max_error_rate: Maximum error rate before stopping
6262
:param over_saturation: Over-saturation detection configuration (bool or dict).
63+
When bool is True, passes --over-saturation=True to avoid Click parsing
64+
issues.
6365
:param data: Data configuration string
6466
:param processor: Processor/tokenizer to use
6567
:param additional_args: Additional command line arguments
68+
:param extra_env: Additional environment variables to set
6669
"""
6770
guidellm_exe = get_guidellm_executable()
6871

@@ -88,7 +91,7 @@ def start_benchmark(
8891
if over_saturation is not None:
8992
if isinstance(over_saturation, bool):
9093
if over_saturation:
91-
cmd_parts.append("--over-saturation")
94+
cmd_parts.append("--over-saturation=True")
9295
elif isinstance(over_saturation, dict):
9396
import json
9497

0 commit comments

Comments
 (0)