Merge lp:~jtran/nova/lp682888 into lp:~hudson-openstack/nova/trunk

Proposed by John Tran
Status: Merged
Approved by: Vish Ishaya
Approved revision: 912
Merged at revision: 942
Proposed branch: lp:~jtran/nova/lp682888
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 69 lines (+33/-1)
2 files modified
Authors (+1/-0)
nova/tests/test_cloud.py (+32/-1)
To merge this branch: bzr merge lp:~jtran/nova/lp682888
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Devin Carlen (community) Approve
Review via email: mp+55452@code.launchpad.net

Commit message

fix bug lp:682888 - DescribeImages has no unit tests.

Description of the change

fix bug lp:682888 - DescribeImages has no unit tests.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
Jay Pipes (jaypipes) wrote :

lgtm2.

review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (339.7 KiB)

The attempt to merge lp:~jtran/nova/lp682888 into lp:nova failed. Below is the output from the failed tests.

AccountsTest
    test_account_create OK
    test_account_delete OK
    test_account_update OK
    test_get_account OK
AdminAPITest
    test_admin_disabled OK
    test_admin_enabled OK
APITest
    test_exceptions_are_converted_to_faults OK
Test
    test_authorize_token OK
    test_authorize_user OK
    test_bad_token OK
    test_bad_user_bad_key OK
    test_bad_user_good_key OK
    test_no_user OK
    test_token_expiry OK
TestFunctional
    test_token_doesnotexist OK
    test_token_expiry OK
TestLimiter
    test_authorize_token OK
LimiterTest
    test_limiter_custom_max_limit OK
    test_limiter_limit_and_offset OK
    test_limiter_limit_medium OK
    test_limiter_limit_over_max OK
    test_limiter_limit_zero OK
    test_limiter_negative_limit OK
    test_limiter_negative_offset OK
    test_limiter_nothing OK
    test_limiter_offset_bad OK
    test_limiter_offset_blank OK
    test_limiter_offset_medium OK
    test_limiter_offset_over_max OK
    test_limiter_offset_zero OK
ActionExtensionTest
    test_extended_action OK
    test_invalid_action OK
    test_invalid_action_body OK
ExtensionControllerTest
    test_get_by_alias OK
    test_index OK
ExtensionManagerTest
    test_get_resources OK
ResourceExtensionTest
    test_get_resources OK
    test_get_resources_with_controller OK
    test_no_extension_present OK
ResponseExtensionTest
    test_get_resources_with_mgr OK
    test_get_resources_with_stub_mgr OK
TestFaults
    test_fault_parts OK
    test_raise OK
    test_re...

Revision history for this message
justinsb (justin-fathomdb) wrote :

That looks like it could be bug 744150 (possibly amongst other things
though).

I'll tidy up the patch and propose...

Revision history for this message
Vish Ishaya (vishvananda) wrote :

These tests pass locally. I'm going to assume this was a weird hudson concurrency issue and fire this off again.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Authors'
2--- Authors 2011-03-25 20:06:38 +0000
3+++ Authors 2011-03-30 00:12:29 +0000
4@@ -32,6 +32,7 @@
5 Joe Heck <heckj@mac.com>
6 Joel Moore <joelbm24@gmail.com>
7 John Dewey <john@dewey.ws>
8+John Tran <jtran@attinteractive.com>
9 Jonathan Bryce <jbryce@jbryce.com>
10 Jordan Rinke <jordan@openstack.org>
11 Josh Durgin <joshd@hq.newdream.net>
12
13=== modified file 'nova/tests/test_cloud.py'
14--- nova/tests/test_cloud.py 2011-03-24 23:38:30 +0000
15+++ nova/tests/test_cloud.py 2011-03-30 00:12:29 +0000
16@@ -41,6 +41,7 @@
17 from nova.api.ec2 import cloud
18 from nova.api.ec2 import ec2utils
19 from nova.image import local
20+from nova.exception import NotFound
21
22
23 FLAGS = flags.FLAGS
24@@ -71,7 +72,8 @@
25 host = self.network.get_network_host(self.context.elevated())
26
27 def fake_show(meh, context, id):
28- return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1}}
29+ return {'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1,
30+ 'type': 'machine'}}
31
32 self.stubs.Set(local.LocalImageService, 'show', fake_show)
33 self.stubs.Set(local.LocalImageService, 'show_by_name', fake_show)
34@@ -216,6 +218,35 @@
35 db.service_destroy(self.context, comp1['id'])
36 db.service_destroy(self.context, comp2['id'])
37
38+ def test_describe_images(self):
39+ describe_images = self.cloud.describe_images
40+
41+ def fake_detail(meh, context):
42+ return [{'id': 1, 'properties': {'kernel_id': 1, 'ramdisk_id': 1,
43+ 'type': 'machine'}}]
44+
45+ def fake_show_none(meh, context, id):
46+ raise NotFound
47+
48+ self.stubs.Set(local.LocalImageService, 'detail', fake_detail)
49+ # list all
50+ result1 = describe_images(self.context)
51+ result1 = result1['imagesSet'][0]
52+ self.assertEqual(result1['imageId'], 'ami-00000001')
53+ # provided a valid image_id
54+ result2 = describe_images(self.context, ['ami-00000001'])
55+ self.assertEqual(1, len(result2['imagesSet']))
56+ # provide more than 1 valid image_id
57+ result3 = describe_images(self.context, ['ami-00000001',
58+ 'ami-00000002'])
59+ self.assertEqual(2, len(result3['imagesSet']))
60+ # provide an non-existing image_id
61+ self.stubs.UnsetAll()
62+ self.stubs.Set(local.LocalImageService, 'show', fake_show_none)
63+ self.stubs.Set(local.LocalImageService, 'show_by_name', fake_show_none)
64+ self.assertRaises(NotFound, describe_images,
65+ self.context, ['ami-fake'])
66+
67 def test_console_output(self):
68 instance_type = FLAGS.default_instance_type
69 max_count = 1