summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorDan Prince <dan.prince@rackspace.com>2011-06-07 21:20:55 +0000
committerTarmac <>2011-06-07 21:20:55 +0000
commit762afdd426c35d1fc82cb7a17683a50ff21e717e (patch)
treebcc67641b338d020d4fd33665e1e9b99fe927c8f /nova/tests
parent11b9bb69513686015067a6405f343c1be508a5eb (diff)
parent8f93aa59aca5440a4d9668942703bf235379ed59 (diff)
DRY up the image_state logic. Fix an issue where glance style images (which aren't required to have an 'image_state' property) couldn't be used to run instances on the EC2 controller.
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/test_cloud.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/nova/tests/test_cloud.py b/nova/tests/test_cloud.py
index a58e8bc39..ba133c860 100644
--- a/nova/tests/test_cloud.py
+++ b/nova/tests/test_cloud.py
@@ -487,6 +487,21 @@ class CloudTestCase(test.TestCase):
self.assertRaises(exception.ApiError, run_instances,
self.context, **kwargs)
+ def test_run_instances_image_status_active(self):
+ kwargs = {'image_id': FLAGS.default_image,
+ 'instance_type': FLAGS.default_instance_type,
+ 'max_count': 1}
+ run_instances = self.cloud.run_instances
+
+ def fake_show_stat_active(self, context, id):
+ return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1,
+ 'type': 'machine'}, 'status': 'active'}
+
+ self.stubs.Set(local.LocalImageService, 'show', fake_show_stat_active)
+
+ result = run_instances(self.context, **kwargs)
+ self.assertEqual(len(result['instancesSet']), 1)
+
def test_terminate_instances(self):
inst1 = db.instance_create(self.context, {'reservation_id': 'a',
'image_ref': 1,