summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-04-27 16:14:26 +0000
committerGerrit Code Review <review@openstack.org>2012-04-27 16:14:26 +0000
commita2249f187caed7c97934cea6fce50ae5360bd0aa (patch)
treef0a6bd93d6b373ae741d02913d935680ca0f4764 /nova/tests
parent8972e9544dead61c198037f24eecf0f04558a914 (diff)
parentbd30eb36bbf2c5164ac47256355c543f6b77e064 (diff)
Merge "Add additional capabilities for computes"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_compute.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index adb50806d..348a7af0f 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -56,6 +56,7 @@ LOG = logging.getLogger(__name__)
FLAGS = flags.FLAGS
flags.DECLARE('stub_network', 'nova.compute.manager')
flags.DECLARE('live_migration_retry_count', 'nova.compute.manager')
+flags.DECLARE('additional_compute_capabilities', 'nova.compute.manager')
orig_rpc_call = rpc.call
@@ -1616,6 +1617,36 @@ class ComputeTestCase(BaseTestCase):
self.compute.add_instance_fault_from_exc(ctxt, instance_uuid,
NotImplementedError('test'))
+ def test_get_additional_capabilities(self):
+ self.flags(additional_compute_capabilities=['test3=xyzzy',
+ 'test4',
+ 'nothertest=blat'])
+ caps = compute_manager._get_additional_capabilities()
+ all_caps = dict(test3='xyzzy',
+ test4=True,
+ nothertest='blat')
+ for c, val in all_caps.items():
+ self.assertTrue(c in caps, c)
+ self.assertEquals(val, caps[c])
+
+ def test_report_driver_status(self):
+ test_caps = dict(test1=1024, test2='foo', nothertest='bar')
+ self.flags(additional_compute_capabilities=['test3=xyzzy',
+ 'test4',
+ 'nothertest=blat'])
+ self.mox.StubOutWithMock(self.compute.driver, 'get_host_stats')
+ self.compute.driver.get_host_stats(refresh=True).AndReturn(test_caps)
+ self.compute._last_host_check = 0
+ self.mox.ReplayAll()
+
+ self.compute._report_driver_status(context)
+ caps = self.compute.last_capabilities
+ all_caps = dict(test1=1024, test2='foo', test3='xyzzy',
+ test4=True, nothertest='bar')
+ for c, val in all_caps.items():
+ self.assertTrue(c in caps, c)
+ self.assertEquals(val, caps[c])
+
def test_cleanup_running_deleted_instances(self):
admin_context = context.get_admin_context()
deleted_at = utils.utcnow() - datetime.timedelta(hours=1, minutes=5)