@@ -404,10 +404,26 @@ def test_instance_resource_decrease(self):
404
404
# Decrease resource requirement
405
405
self .__update_instance_count (
406
406
1 , 1 ,
407
- "{\n count: 1\n kind: KIND_CPU\n rate_limiter {\n resources [\n {\n name: \" R1\" \n count: 2 \n }\n ]\n }\n }"
407
+ "{\n count: 1\n kind: KIND_CPU\n rate_limiter {\n resources [\n {\n name: \" R1\" \n count: 3 \n }\n ]\n }\n }"
408
408
)
409
409
# Unload model
410
410
self .__unload_model ()
411
+ # The resource count of 3 is unique across this entire test, so check
412
+ # the server output to make sure it is printed, which ensures the
413
+ # max resource is actually decreased.
414
+ time .sleep (1 ) # make sure the log file is updated
415
+ log_path = os .path .join (
416
+ os .environ ["MODEL_LOG_DIR" ], "instance_update_test.rate_limit_" +
417
+ os .environ ["RATE_LIMIT_MODE" ] + ".server.log" )
418
+ with open (log_path , mode = "r" , encoding = "utf-8" , errors = "strict" ) as f :
419
+ if os .environ ["RATE_LIMIT_MODE" ] == "execution_count" :
420
+ # Make sure the previous max resource limit of 4 is reduced to 3
421
+ # when no explicit limit is set.
422
+ self .assertIn ("Resource: R1\t Count: 3" , f .read ())
423
+ else :
424
+ # Make sure the max resource limit is never set to 3 when
425
+ # explicit limit of 10 is set.
426
+ self .assertNotIn ("Resource: R1\t Count: 3" , f .read ())
411
427
412
428
# Test for instance update on direct sequence scheduling
413
429
@unittest .skip ("Sequence will not continue after update [FIXME: DLIS-4820]" )
0 commit comments