ExtensionTestCase: register correct core plugin

We should register the passed plugin as core only if service_type is
False. Otherwise, the passed plugin is a service plugin, in which case
we should register some other core plugin for the test. The easiest
thing is to use the base db plugin for that matter.

This fixes subproject unit tests because now the core plugin will always
have _get_collection function that is needed by some underlying db api
functions.

Change-Id: Ica421831763eb2f5d25fc068287305b402227b53
Closes-Bug: #1676656
This commit is contained in:
Ihar Hrachyshka 2017-03-28 01:57:51 +00:00
parent 42d2fc2d8c
commit bae6555816
1 changed files with 5 additions and 3 deletions

View File

@ -32,6 +32,9 @@ from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit import testlib_api
CORE_PLUGIN = 'neutron.db.db_base_plugin_v2.NeutronDbPluginV2'
class ExtensionTestCase(testlib_api.WebTestCase):
def _setUpExtension(self, plugin, service_type,
@ -55,9 +58,8 @@ class ExtensionTestCase(testlib_api.WebTestCase):
# Create the default configurations
self.config_parse()
# just stubbing core plugin with plugin
self.setup_coreplugin(plugin, load_plugins=False)
cfg.CONF.set_override('core_plugin', plugin)
core_plugin = CORE_PLUGIN if service_type else plugin
self.setup_coreplugin(core_plugin, load_plugins=False)
if service_type:
cfg.CONF.set_override('service_plugins', [plugin])