summaryrefslogtreecommitdiff
path: root/nova/test.py
diff options
context:
space:
mode:
authorDan Smith <dansmith@redhat.com>2022-08-11 09:50:30 -0700
committerDan Smith <dansmith@redhat.com>2022-08-18 07:22:37 -0700
commitc178d9360665c219cbcc71c9f37b9e6e3055a5e5 (patch)
tree319663342124fe6a976efc273092a0c06f0bfbea /nova/test.py
parent627af67f5e631e8e1b23aa1527517a6cd6abd462 (diff)
downloadnova-c178d9360665c219cbcc71c9f37b9e6e3055a5e5.tar.gz
Unify placement client singleton implementations
We have many places where we implement singleton behavior for the placement client. This unifies them into a single place and implementation. Not only does this DRY things up, but may cause us to initialize it fewer times and also allows for emitting a common set of error messages about expected failures for better troubleshooting. Change-Id: Iab8a791f64323f996e1d6e6d5a7e7a7c34eb4fb3 Related-Bug: #1846820
Diffstat (limited to 'nova/test.py')
-rw-r--r--nova/test.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/test.py b/nova/test.py
index d645d06cfa..689d5ba291 100644
--- a/nova/test.py
+++ b/nova/test.py
@@ -61,6 +61,7 @@ from nova import exception
from nova import objects
from nova.objects import base as objects_base
from nova import quota
+from nova.scheduler.client import report
from nova.tests import fixtures as nova_fixtures
from nova.tests.unit import matchers
from nova import utils
@@ -291,6 +292,9 @@ class TestCase(base.BaseTestCase):
# instead of only once initialized for test worker
wsgi_app.init_global_data.reset()
+ # Reset the placement client singleton
+ report.PLACEMENTCLIENT = None
+
def _setup_cells(self):
"""Setup a normal cellsv2 environment.