99 assert_constraint_triggered ,
1010 assert_no_python_exceptions ,
1111 assert_successful_requests_fields ,
12- cleanup_report_file ,
1312 load_benchmark_report ,
1413)
1514from tests .e2e .vllm_sim_server import VllmSimServer
@@ -53,34 +52,28 @@ def test_max_seconds_benchmark(server: VllmSimServer, tmp_path: Path):
5352 outputs = report_name ,
5453 )
5554
56- try :
57- # Start the benchmark
58- client .start_benchmark (
59- rate = rate ,
60- max_seconds = max_seconds ,
61- )
62-
63- # Wait for the benchmark to complete
64- client .wait_for_completion (timeout = 30 )
55+ # Start the benchmark
56+ client .start_benchmark (
57+ rate = rate ,
58+ max_seconds = max_seconds ,
59+ )
6560
66- # Assert no Python exceptions occurred
67- assert_no_python_exceptions ( client .stderr )
61+ # Wait for the benchmark to complete
62+ client .wait_for_completion ( timeout = 30 )
6863
69- # Load and validate the report
70- report = load_benchmark_report (report_path )
71- benchmark = report ["benchmarks" ][0 ]
64+ # Assert no Python exceptions occurred
65+ assert_no_python_exceptions (client .stderr )
7266
73- # Check that the max duration constraint was triggered
74- assert_constraint_triggered (
75- benchmark , "max_seconds" , {"duration_exceeded" : True }
76- )
67+ # Load and validate the report
68+ report = load_benchmark_report (report_path )
69+ benchmark = report ["benchmarks" ][0 ]
7770
78- # Validate successful requests have all expected fields
79- successful_requests = benchmark ["requests" ]["successful" ]
80- assert_successful_requests_fields (successful_requests )
71+ # Check that the max duration constraint was triggered
72+ assert_constraint_triggered (benchmark , "max_seconds" , {"duration_exceeded" : True })
8173
82- finally :
83- cleanup_report_file (report_path )
74+ # Validate successful requests have all expected fields
75+ successful_requests = benchmark ["requests" ]["successful" ]
76+ assert_successful_requests_fields (successful_requests )
8477
8578
8679@pytest .mark .timeout (30 )
@@ -102,35 +95,28 @@ def test_max_requests_benchmark(server: VllmSimServer, tmp_path: Path):
10295 outputs = report_name ,
10396 )
10497
105- try :
106- # Start the benchmark
107- client .start_benchmark (
108- rate = rate ,
109- max_requests = max_requests ,
110- )
111-
112- # Wait for the benchmark to complete
113- client .wait_for_completion (timeout = 30 )
114-
115- # Assert no Python exceptions occurred
116- assert_no_python_exceptions (client .stderr )
117-
118- # Load and validate the report
119- report = load_benchmark_report (report_path )
120- benchmark = report ["benchmarks" ][0 ]
121-
122- # Check that the max requests constraint was triggered
123- assert_constraint_triggered (
124- benchmark , "max_requests" , {"processed_exceeded" : True }
125- )
126-
127- # Validate successful requests have all expected fields
128- successful_requests = benchmark ["requests" ]["successful" ]
129- assert len (successful_requests ) == max_requests , (
130- f"Expected { max_requests } successful requests, "
131- f"got { len (successful_requests )} "
132- )
133- assert_successful_requests_fields (successful_requests )
98+ # Start the benchmark
99+ client .start_benchmark (
100+ rate = rate ,
101+ max_requests = max_requests ,
102+ )
134103
135- finally :
136- cleanup_report_file (report_path )
104+ # Wait for the benchmark to complete
105+ client .wait_for_completion (timeout = 30 )
106+
107+ # Assert no Python exceptions occurred
108+ assert_no_python_exceptions (client .stderr )
109+
110+ # Load and validate the report
111+ report = load_benchmark_report (report_path )
112+ benchmark = report ["benchmarks" ][0 ]
113+
114+ # Check that the max requests constraint was triggered
115+ assert_constraint_triggered (benchmark , "max_requests" , {"processed_exceeded" : True })
116+
117+ # Validate successful requests have all expected fields
118+ successful_requests = benchmark ["requests" ]["successful" ]
119+ assert len (successful_requests ) == max_requests , (
120+ f"Expected { max_requests } successful requests, got { len (successful_requests )} "
121+ )
122+ assert_successful_requests_fields (successful_requests )
0 commit comments