Skip to content

Commit 1158fee

Browse files
committed
Test server option set --allow-metrics=false
1 parent 89ca6f4 commit 1158fee

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

ci/L0_backend_vllm/metrics_test/test.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ set -e
114114
kill $SERVER_PID
115115
wait $SERVER_PID
116116

117-
# Test vLLM metrics reporting with parameter "REPORT_METRICS" set to "no" in config.pbtxt
117+
# Test vLLM metrics reporting with parameter "REPORT_METRICS" set to "yes" in config.pbtxt
118118
cp ${SAMPLE_MODELS_REPO}/vllm_model/config.pbtxt models/vllm_opt
119119
echo -e "
120120
parameters: {
@@ -149,6 +149,35 @@ else
149149
fi
150150
set -e
151151

152+
kill $SERVER_PID
153+
wait $SERVER_PID
154+
155+
# Test enabling vLLM metrics reporting in config.pbtxt while disabling in server option
156+
SERVER_ARGS="${SERVER_ARGS} --allow-metrics=false"
157+
run_server
158+
if [ "$SERVER_PID" == "0" ]; then
159+
cat $SERVER_LOG
160+
echo -e "\n***\n*** Failed to start $SERVER\n***"
161+
exit 1
162+
fi
163+
164+
set +e
165+
python3 $CLIENT_PY VLLMTritonMetricsTest.test_vllm_metrics_refused -v > $CLIENT_LOG 2>&1
166+
167+
if [ $? -ne 0 ]; then
168+
cat $CLIENT_LOG
169+
echo -e "\n***\n*** Running $CLIENT_PY VLLMTritonMetricsTest.test_vllm_metrics_refused FAILED. \n***"
170+
RET=1
171+
else
172+
check_test_results $TEST_RESULT_FILE $EXPECTED_NUM_TESTS
173+
if [ $? -ne 0 ]; then
174+
cat $CLIENT_LOG
175+
echo -e "\n***\n*** Test Result Verification FAILED.\n***"
176+
RET=1
177+
fi
178+
fi
179+
set -e
180+
152181
kill $SERVER_PID
153182
wait $SERVER_PID
154183
rm -rf "./models" "temp.json"

ci/L0_backend_vllm/metrics_test/vllm_metrics_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,16 @@ def test_vllm_metrics_disabled(self):
137137
# No vLLM metric found
138138
self.assertEqual(len(metrics_dict), 0)
139139

140+
def test_vllm_metrics_refused(self):
141+
# Test vLLM metrics
142+
self.vllm_infer(
143+
prompts=self.prompts,
144+
sampling_parameters=self.sampling_parameters,
145+
model_name=self.vllm_model_name,
146+
)
147+
with self.assertRaises(requests.exceptions.ConnectionError):
148+
self.get_vllm_metrics()
149+
140150
def tearDown(self):
141151
self.triton_client.close()
142152

0 commit comments

Comments
 (0)