summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJustin Santa Barbara <justin@fathomdb.com>2011-03-24 09:21:51 +0000
committerTarmac <>2011-03-24 09:21:51 +0000
commit08fd7016db5b0e435b8d9728345739afcf3cb152 (patch)
treec7d8ac401025037cbc841cbeab47d7b5800b9851 /nova/tests
parent86b3cc94bc672fda7925a247c3b7c2f85be2c5b5 (diff)
parent40a6ded37544dcfe44ba9d3ef247339122c93b43 (diff)
Poll instance states periodically, so that we can detect when something changes 'behind the scenes'.
Beginnings of work on Bug #661214 and Bug #661260.
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_compute.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/nova/tests/test_compute.py b/nova/tests/test_compute.py
index 44d04a12f..14ff8842b 100644
--- a/nova/tests/test_compute.py
+++ b/nova/tests/test_compute.py
@@ -626,3 +626,24 @@ class ComputeTestCase(test.TestCase):
db.instance_destroy(c, instance_id)
db.volume_destroy(c, v_ref['id'])
db.floating_ip_destroy(c, flo_addr)
+
+ def test_run_kill_vm(self):
+ """Detect when a vm is terminated behind the scenes"""
+ instance_id = self._create_instance()
+
+ self.compute.run_instance(self.context, instance_id)
+
+ instances = db.instance_get_all(context.get_admin_context())
+ LOG.info(_("Running instances: %s"), instances)
+ self.assertEqual(len(instances), 1)
+
+ instance_name = instances[0].name
+ self.compute.driver.test_remove_vm(instance_name)
+
+ # Force the compute manager to do its periodic poll
+ error_list = self.compute.periodic_tasks(context.get_admin_context())
+ self.assertFalse(error_list)
+
+ instances = db.instance_get_all(context.get_admin_context())
+ LOG.info(_("After force-killing instances: %s"), instances)
+ self.assertEqual(len(instances), 0)