Skip to content

Commit 126b986

Browse files
committed
Add test on rate limiter max resource decrease update
1 parent 1185555 commit 126b986

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

qa/L0_model_update/instance_update_test.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,10 @@ def test_infer_while_updating(self):
338338
# Unload model
339339
self.__unload_model()
340340

341-
# Test instance resource requirement increase
341+
# Test instance resource requirement update
342342
@unittest.skipUnless(os.environ["RATE_LIMIT_MODE"] == "execution_count",
343343
"Rate limiter precondition not met for this test")
344-
def test_instance_resource_increase(self):
344+
def test_instance_resource_update(self):
345345
# Load model
346346
self.__load_model(
347347
1,
@@ -365,6 +365,20 @@ def infer():
365365
time.sleep(infer_count / 2) # each infer should take < 0.5 seconds
366366
self.assertNotIn(False, infer_complete, "Infer possibly stuck")
367367
infer_thread.result()
368+
# Decrease the resource requirement
369+
self.__update_instance_count(
370+
1, 1,
371+
"{\ncount: 1\nkind: KIND_CPU\nrate_limiter {\nresources [\n{\nname: \"R1\"\ncount: 6\n}\n]\n}\n}"
372+
)
373+
# Further decrease the resource requirement. The previous decrease
374+
# should have lower the max resource in the rate limiter, which the
375+
# error "Should not print this ..." should not be printed into the
376+
# server log because the max resource is above the previously set limit
377+
# and it will be checked by the main bash test script.
378+
self.__update_instance_count(
379+
1, 1,
380+
"{\ncount: 1\nkind: KIND_CPU\nrate_limiter {\nresources [\n{\nname: \"R1\"\ncount: 4\n}\n]\n}\n}"
381+
)
368382
# Unload model
369383
self.__unload_model()
370384

qa/L0_model_update/test.sh

+9
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ for RATE_LIMIT_MODE in "off" "execution_count"; do
8383
kill $SERVER_PID
8484
wait $SERVER_PID
8585

86+
set +e
87+
grep "Should not print this" $SERVER_LOG
88+
if [ $? -eq 0 ]; then
89+
echo -e "\n***\n*** Found \"Should not print this\" on \"$SERVER_LOG\"\n***"
90+
cat $SERVER_LOG
91+
RET=1
92+
fi
93+
set -e
94+
8695
done
8796

8897
if [ $RET -eq 0 ]; then

0 commit comments

Comments
 (0)