UT: fix a flaw in test_get_label_by_id unit test in test_monkey.py that incorrectly asserts the hit/miss of monkey label cache

This commit is contained in:
VakarisZ 2021-11-17 17:25:11 +02:00
parent 58406bccd1
commit 216af633ad
1 changed files with 3 additions and 3 deletions

View File

@ -134,14 +134,14 @@ class TestMonkey:
assert cache_info_after_query_2.hits == 1 assert cache_info_after_query_2.hits == 1
assert cache_info_after_query_2.misses == 1 assert cache_info_after_query_2.misses == 1
# should be a miss # should be a another hit, since the monkey ID is already cached
label = Monkey.get_label_by_id(linux_monkey.id) label = Monkey.get_label_by_id(linux_monkey.id)
logger.debug("3) ID: {} label: {}".format(linux_monkey.id, label)) logger.debug("3) ID: {} label: {}".format(linux_monkey.id, label))
cache_info_after_query_3 = Monkey.get_label_by_id.storage.backend.cache_info() cache_info_after_query_3 = Monkey.get_label_by_id.storage.backend.cache_info()
logger.debug("Cache info: {}".format(str(cache_info_after_query_3))) logger.debug("Cache info: {}".format(str(cache_info_after_query_3)))
# still 1 hit only # still 1 hit only
assert cache_info_after_query_3.hits == 1 assert cache_info_after_query_3.hits == 2
assert cache_info_after_query_3.misses == 2 assert cache_info_after_query_3.misses == 1
@pytest.mark.usefixtures("uses_database") @pytest.mark.usefixtures("uses_database")
def test_is_monkey(self): def test_is_monkey(self):