Merge lp:~jaypipes/glance/bug767203 into lp:~hudson-openstack/glance/trunk

Proposed by Jay Pipes
Status: Merged
Approved by: Jay Pipes
Approved revision: 121
Merged at revision: 121
Proposed branch: lp:~jaypipes/glance/bug767203
Merge into: lp:~hudson-openstack/glance/trunk
Diff against target: 67 lines (+23/-2)
2 files modified
bin/glance (+2/-1)
tests/functional/test_bin_glance.py (+21/-1)
To merge this branch: bzr merge lp:~jaypipes/glance/bug767203
Reviewer Review Type Date Requested Status
Édouard Thuleau (community) Approve
Dan Prince (community) Approve
Brian Waldon (community) Approve
Glance Core security contacts Pending
Review via email: mp+58559@code.launchpad.net

Description of the change

Adds a test case for updating an image's Name attribute. glance update was not regarding 'name' as a top-level modifiable attribute...

To post a comment you must log in.
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Looks good.

review: Approve
Revision history for this message
Dan Prince (dan-prince) wrote :

Works great.

review: Approve
Revision history for this message
Édouard Thuleau (ethuleau) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/glance'
2--- bin/glance 2011-04-08 02:11:49 +0000
3+++ bin/glance 2011-04-20 19:19:08 +0000
4@@ -232,6 +232,7 @@
5 Field names that can be specified:
6
7 name A name for the image.
8+location The location of the image.
9 is_public If specified, interpreted as a boolean value
10 and sets or unsets the image's availability to the public.
11 disk_format Format of the disk image
12@@ -263,7 +264,7 @@
13 print 'Found non-modifiable field %s. Removing.' % field
14 fields.pop(field)
15
16- base_image_fields = ['disk_format', 'container_format',
17+ base_image_fields = ['disk_format', 'container_format', 'name',
18 'location']
19 for field in base_image_fields:
20 fvalue = fields.pop(field, None)
21
22=== modified file 'tests/functional/test_bin_glance.py'
23--- tests/functional/test_bin_glance.py 2011-04-20 17:27:02 +0000
24+++ tests/functional/test_bin_glance.py 2011-04-20 19:19:08 +0000
25@@ -91,7 +91,7 @@
26
27 def test_add_list_update_list(self):
28 """
29- Test for LP Bug #736295
30+ Test for LP Bugs #736295, #767203
31 We test the following:
32
33 0. Verify no public images in index
34@@ -99,6 +99,8 @@
35 2. Check that image does not appear in index
36 3. Update the image to be public
37 4. Check that image now appears in index
38+ 5. Update the image's Name attribute
39+ 6. Verify the updated name is shown
40 """
41
42 self.cleanup()
43@@ -149,6 +151,24 @@
44 image_data_line = lines[3]
45 self.assertTrue('MyImage' in image_data_line)
46
47+ # 5. Update the image's Name attribute
48+ updated_image_name = "Updated image name"
49+ cmd = "bin/glance --port=%d update 1 is_public=True name=\"%s\"" \
50+ % (api_port, updated_image_name)
51+
52+ exitcode, out, err = execute(cmd)
53+
54+ self.assertEqual(0, exitcode)
55+ self.assertEqual('Updated image 1', out.strip())
56+
57+ # 6. Verify updated name shown
58+ cmd = "bin/glance --port=%d index" % api_port
59+ exitcode, out, err = execute(cmd)
60+
61+ self.assertEqual(0, exitcode)
62+ self.assertTrue(updated_image_name in out,
63+ "%s not found in %s" % (updated_image_name, out))
64+
65 self.stop_servers()
66
67 @functional.runs_sql

Subscribers

People subscribed via source and target branches