Skip to content

Commit f1d9db9

Browse files
fix: e2e tests work as expected
1 parent 041aa14 commit f1d9db9

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

tests/e2e/test_interrupted.py

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_interrupted_report(server: VllmSimServer):
3939
--target "{server.get_url()}" \
4040
--rate-type constant \
4141
--rate {rate} \
42-
--max-seconds 1000 \
42+
--max-seconds 60 \
4343
--max-error {max_error_rate} \
4444
--data "prompt_tokens=256,output_tokens=128" \
4545
--output-path {report_path}
@@ -52,37 +52,37 @@ def test_interrupted_report(server: VllmSimServer):
5252
logger.info("Waiting for client to start...")
5353
time.sleep(5)
5454
server.stop()
55-
logger.info("Waiting for client to stop...")
56-
time.sleep(5)
57-
58-
logger.info("Fetching client output")
59-
stdout, stderr = process.communicate()
60-
logger.info(f"Client stdout:\n{stdout}")
61-
logger.info(f"Client stderr:\n{stderr}")
6255

63-
assert report_path.exists()
64-
with report_path.open("r") as f:
65-
report = json.load(f)
56+
try:
57+
logger.info("Fetching client output")
58+
stdout, stderr = process.communicate()
59+
logger.info(f"Client stdout:\n{stdout}")
60+
logger.info(f"Client stderr:\n{stderr}")
6661

67-
assert "benchmarks" in report
68-
benchmarks = report["benchmarks"]
69-
assert len(benchmarks) > 0
70-
benchmark = benchmarks[0]
71-
assert "requests" in benchmark
72-
requests = benchmark["requests"]
73-
assert "successful" in requests
74-
successful = requests["successful"]
75-
assert "errored" in requests
76-
errored = requests["errored"]
77-
assert len(errored) / (len(successful) + len(errored)) > max_error_rate
62+
assert report_path.exists()
63+
with report_path.open("r") as f:
64+
report = json.load(f)
7865

79-
report_path.unlink()
66+
assert "benchmarks" in report
67+
benchmarks = report["benchmarks"]
68+
assert len(benchmarks) > 0
69+
benchmark = benchmarks[0]
70+
assert "requests" in benchmark
71+
requests = benchmark["requests"]
72+
assert "successful" in requests
73+
successful = requests["successful"]
74+
assert "errored" in requests
75+
errored = requests["errored"]
76+
assert len(errored) / (len(successful) + len(errored)) > max_error_rate
77+
finally:
78+
if report_path.exists():
79+
report_path.unlink()
8080

81-
process.terminate() # Send SIGTERM
82-
try:
83-
process.wait(timeout=5) # Wait for the process to terminate
84-
logger.info("Client stopped successfully.")
85-
except subprocess.TimeoutExpired:
86-
logger.warning("Client did not terminate gracefully, killing it...")
87-
process.kill() # Send SIGKILL if it doesn't terminate
88-
process.wait()
81+
process.terminate() # Send SIGTERM
82+
try:
83+
process.wait(timeout=5) # Wait for the process to terminate
84+
logger.info("Client stopped successfully.")
85+
except subprocess.TimeoutExpired:
86+
logger.warning("Client did not terminate gracefully, killing it...")
87+
process.kill() # Send SIGKILL if it doesn't terminate
88+
process.wait()

tests/e2e/vllm_sim_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def stop(self):
115115
logger.info(f"Stopping server on {self.server_url}...")
116116
self.process.terminate() # Send SIGTERM
117117
try:
118-
self.process.wait(timeout=5) # Wait for the process to terminate
118+
self.process.wait(timeout=1) # Wait for the process to terminate
119119
logger.info("Server stopped successfully.")
120120
except subprocess.TimeoutExpired:
121121
logger.warning("Server did not terminate gracefully, killing it...")

0 commit comments

Comments
 (0)