Clear cache before retrying to get containers info

When container states unexpectedly change after a reboot, a mechanism
within assert_equal_containers_state method retries to get containers
info for some time
Since lru_cache functionality was introduced, that retry mechanism has
not worked properly because the data obtained at every iteration
is cached
lru_cache needs to be clean before each retry

Due to this problem, tests failing at this point were making tox process
end without running any more tests, raising the following exception:
ValueError: Length too long: 4460487

Change-Id: Ifb45841138737ec49d148c0f4d3626caf709739d
This commit is contained in:
Eduardo Olivares 2020-06-18 18:55:07 +02:00
parent 779822ef6b
commit 50c9086349

View File

@ -385,6 +385,8 @@ def assert_equal_containers_state(expected_containers_list=None,
to_string(index=False), error_info))
LOG.info('container states mismatched:\n{}\n'.format(failures))
time.sleep(interval)
# clear cache to obtain new data
list_node_containers.cache_clear()
else:
LOG.info("assert_equal_containers_state :"
" OK, all containers are on the same state")