diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-06-18 15:33:49 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-06-18 15:33:49 +0000 |
| commit | f5ca941543847e62426cf1166a68053d711d4e32 (patch) | |
| tree | 88f4e95725d1e79d12efc48ec7f94938f5d214ba /tests | |
| parent | 9f938720f158889252fa1db44be96745fa48e1ff (diff) | |
| parent | 91fc479399ab12d8ba670c3627582ebfc3950af8 (diff) | |
Merge "rpc: Update rpc_backend handling."
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/rpc/test_common.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/unit/rpc/test_common.py b/tests/unit/rpc/test_common.py index 73fb733..0b282eb 100644 --- a/tests/unit/rpc/test_common.py +++ b/tests/unit/rpc/test_common.py @@ -25,6 +25,8 @@ import unittest from openstack.common import cfg from openstack.common import context from openstack.common import exception +from openstack.common import importutils +from openstack.common import rpc from openstack.common.rpc import amqp as rpc_amqp from openstack.common.rpc import common as rpc_common from tests.unit.rpc import common @@ -148,3 +150,26 @@ class RpcCommonTestCase(unittest.TestCase): #assure the traceback was added self.assertTrue('raise FakeIDontExistException' in unicode(after_exc)) FLAGS.reset() + + def test_loading_old_nova_config(self): + FLAGS.set_override('rpc_backend', 'nova.rpc.impl_qpid') + rpc._RPCIMPL = None + + self.mod = None + + def fake_import_module(m): + if not self.mod: + # The first time import_module is called, before the replace() + self.mod = m + raise ImportError + self.mod = m + + orig_import_module = importutils.import_module + importutils.import_module = fake_import_module + + rpc._get_impl() + + importutils.import_module = orig_import_module + FLAGS.reset() + + self.assertEqual(self.mod, 'nova.openstack.common.rpc.impl_qpid') |
