summaryrefslogtreecommitdiffstats
path: root/nova/tests/conductor
diff options
context:
space:
mode:
authorDan Smith <danms@us.ibm.com>2013-03-14 13:34:30 -0400
committerDan Smith <danms@us.ibm.com>2013-03-14 16:22:37 -0400
commit3a48c1ad3cd39283ed9e26ff0ca2b7986a2aabea (patch)
treeabcabd7c9a6d9e1a4c688c29fb13cef5ee6a38f0 /nova/tests/conductor
parent9df61c0b06dd81f34d97fbc02030f92928e21a78 (diff)
downloadnova-3a48c1ad3cd39283ed9e26ff0ca2b7986a2aabea.tar.gz
nova-3a48c1ad3cd39283ed9e26ff0ca2b7986a2aabea.tar.xz
nova-3a48c1ad3cd39283ed9e26ff0ca2b7986a2aabea.zip
Make conductor's quota methods pass project_id properly
Commit 652a487ed9daba9ae97f7df77ae35720322d1af3 added a workaround for project_id on conductor's quota methods. This fully plumbs project_id through to the manager (and thus the quota implementation) and removes the tests that verify the workaround. Fixes bug 1153795 Change-Id: I7cd5e3de39acfaba7831892aff6c754569c8e1bf
Diffstat (limited to 'nova/tests/conductor')
-rw-r--r--nova/tests/conductor/test_conductor.py42
1 files changed, 6 insertions, 36 deletions
diff --git a/nova/tests/conductor/test_conductor.py b/nova/tests/conductor/test_conductor.py
index dd779c778..df0f5e73b 100644
--- a/nova/tests/conductor/test_conductor.py
+++ b/nova/tests/conductor/test_conductor.py
@@ -546,15 +546,19 @@ class _BaseTestCase(object):
def test_quota_commit(self):
self.mox.StubOutWithMock(quota.QUOTAS, 'commit')
- quota.QUOTAS.commit(self.context, 'reservations')
+ quota.QUOTAS.commit(self.context, 'reservations', project_id=None)
+ quota.QUOTAS.commit(self.context, 'reservations', project_id='proj')
self.mox.ReplayAll()
self.conductor.quota_commit(self.context, 'reservations')
+ self.conductor.quota_commit(self.context, 'reservations', 'proj')
def test_quota_rollback(self):
self.mox.StubOutWithMock(quota.QUOTAS, 'rollback')
- quota.QUOTAS.rollback(self.context, 'reservations')
+ quota.QUOTAS.rollback(self.context, 'reservations', project_id=None)
+ quota.QUOTAS.rollback(self.context, 'reservations', project_id='proj')
self.mox.ReplayAll()
self.conductor.quota_rollback(self.context, 'reservations')
+ self.conductor.quota_rollback(self.context, 'reservations', 'proj')
def test_get_ec2_ids(self):
expected = {
@@ -1067,40 +1071,6 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase):
self.conductor.security_groups_trigger_handler(self.context,
'event', 'arg')
- def test_quota_commit_with_project_id(self):
- diff_proj_id = 'diff_fake_proj_id'
- self.assertNotEqual(self.context.project_id, diff_proj_id)
- call_info = {}
-
- def mgr_quota_commit(ctxt, reservations):
- call_info['resvs'] = reservations
- call_info['project_id'] = ctxt.project_id
-
- self.stubs.Set(self.conductor_manager, 'quota_commit',
- mgr_quota_commit)
-
- self.conductor.quota_commit(self.context, 'fake_resvs',
- project_id=diff_proj_id)
- self.assertEqual(diff_proj_id, call_info['project_id'])
- self.assertEqual('fake_resvs', call_info['resvs'])
-
- def test_quota_rollback_with_project_id(self):
- diff_proj_id = 'diff_fake_proj_id'
- self.assertNotEqual(self.context.project_id, diff_proj_id)
- call_info = {}
-
- def mgr_quota_rollback(ctxt, reservations):
- call_info['resvs'] = reservations
- call_info['project_id'] = ctxt.project_id
-
- self.stubs.Set(self.conductor_manager, 'quota_rollback',
- mgr_quota_rollback)
-
- self.conductor.quota_rollback(self.context, 'fake_resvs',
- project_id=diff_proj_id)
- self.assertEqual(diff_proj_id, call_info['project_id'])
- self.assertEqual('fake_resvs', call_info['resvs'])
-
class ConductorLocalAPITestCase(ConductorAPITestCase):
"""Conductor LocalAPI Tests."""