Reset the _RC_CACHE between tests

Very rarely the _RC_CACHE used for caching ResourceClass id and name
mappings will be wrong for tests, resulting in the find() method on
InventoryList returning None leading to inv.capacity calls failing.

This only showed up in the tests for
Iea182341f9419cb514a044f76864d6bec60a3683 where the order of tests
are changed because of a lot of renaming of modules.

Change-Id: Idc318d3914fa600deff613d8a43eadd9073fa262
Closes-Bug: #1747003
This commit is contained in:
Chris Dent 2018-02-02 14:40:44 +00:00
parent 8ac8c995ca
commit 95ad6a2a9a
1 changed files with 2 additions and 1 deletions

View File

@ -308,8 +308,9 @@ class TestCase(testtools.TestCase):
# caching of that value.
utils._IS_NEUTRON = None
# Reset the traits sync flag
# Reset the traits sync and rc cache flags
objects.resource_provider._TRAITS_SYNCED = False
objects.resource_provider._RC_CACHE = None
# Reset the global QEMU version flag.
images.QEMU_VERSION = None