[placement] Flush RC_CACHE after each gabbit sequence

Each gabbi yaml file is supposed to be an isolated sequence. The
fixtures were already making sure that the database was wiped, and the
traits sync was reset, but not making sure the _RC_CACHE used to cache
mappings between resource class strings and ids was flushed.

This change clears the _RC_CACHE in the APIFixture stop_fixture method.

For sake of information:
Before fixing the issue it was confirmed by running the two gabbi files
indicated in the bug report, in sequence, in a single process:

    .tox/functional/bin/python -m subunit.run discover \
        nova.tests.functional.api.openstack.placement \
        --load-list /tmp/runthese |subunit-trace

Where runthese contains (with fully qualified package name prefixes):

test_placement_api.allocation-bad-class_allocate_some_of_it_standard.test_request
test_placement_api.resource-class-in-use_delete_resource_class.test_request

Change-Id: Icb3beef7964887f29bf8cca95ac7dbae1511876d
Closes-Bug: #1706207
This commit is contained in:
Chris Dent 2017-07-25 01:59:52 +01:00
parent b25ca6b898
commit 997ba03094
1 changed files with 5 additions and 3 deletions

View File

@ -84,10 +84,12 @@ class APIFixture(fixture.GabbiFixture):
self.api_db_fixture.cleanup()
self.main_db_fixture.cleanup()
# NOTE(sbauza): Since we clean up the DB, we need to also reset the
# traits sync flag for making sure that next run will recreate the
# traits.
# Since we clean up the DB, we need to reset the traits sync
# flag to make sure the next run will recreate the traits and
# reset the _RC_CACHE so that any cached resource classes
# are flushed.
objects.resource_provider._TRAITS_SYNCED = False
objects.resource_provider._RC_CACHE = None
self.output_stream_fixture.cleanUp()
self.standard_logging_fixture.cleanUp()