Skip to content

Commit fbdf0ce

Browse files
committed
Check server log for decreased resource limit
1 parent 95c92f7 commit fbdf0ce

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

qa/L0_model_update/instance_update_test.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,26 @@ def test_instance_resource_decrease(self):
404404
# Decrease resource requirement
405405
self.__update_instance_count(
406406
1, 1,
407-
"{\ncount: 1\nkind: KIND_CPU\nrate_limiter {\nresources [\n{\nname: \"R1\"\ncount: 2\n}\n]\n}\n}"
407+
"{\ncount: 1\nkind: KIND_CPU\nrate_limiter {\nresources [\n{\nname: \"R1\"\ncount: 3\n}\n]\n}\n}"
408408
)
409409
# Unload model
410410
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())
411427

412428
# Test for instance update on direct sequence scheduling
413429
@unittest.skip("Sequence will not continue after update [FIXME: DLIS-4820]")

0 commit comments

Comments
 (0)