From 19e553e1deeb8939decd1ed9554a3c6eb6770386 Mon Sep 17 00:00:00 2001 From: Yusuke Muraoka Date: Tue, 28 Aug 2012 09:59:42 +0000 Subject: [PATCH] Plugin aware extensions should also be reset at each test setup PluginAwareExtensionManager caches extension according plugin. At each db plugin test setup, testing plugin and router are newly created. However, the extension manager held the extensions for first time loaded plugin. Because of their cache. So if a plugin conditional extension exists, it could not be loaded by testing order. Fixes bug 1043381. Change-Id: Ic994aab61c3d67aa9d422594484049f41ff8b321 --- quantum/tests/unit/test_db_plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/quantum/tests/unit/test_db_plugin.py b/quantum/tests/unit/test_db_plugin.py index 73184f236..f39ca762c 100644 --- a/quantum/tests/unit/test_db_plugin.py +++ b/quantum/tests/unit/test_db_plugin.py @@ -34,6 +34,7 @@ from quantum import context from quantum.db import api as db from quantum.db import db_base_plugin_v2 from quantum.db import models_v2 +from quantum.extensions.extensions import PluginAwareExtensionManager from quantum.manager import QuantumManager from quantum.openstack.common import cfg from quantum.openstack.common import timeutils @@ -63,6 +64,8 @@ class QuantumDbPluginV2TestCase(unittest2.TestCase): db._MAKER = None # Make sure at each test a new instance of the plugin is returned QuantumManager._instance = None + # Make sure at each test according extensions for the plugin is loaded + PluginAwareExtensionManager._instance = None # Save the attributes map in case the plugin will alter it # loading extensions # Note(salvatore-orlando): shallow copy is not good enough in -- 2.45.2