change test_register_http_image to use explicit url

previously test_register_http_image did some black magic with
sending an image into swift then using swift as an http server
for the purposes of this test. However there is no other requirement
in this test that swift is actually running, so it breaks under
a default devstack env (and possibly other enviroments).

The real test is whether an http image can be pulled into glance.
Use the cirros image as a default, but allow people to specify
another value if they don't have internet access.

attempt to fix pep8

Change-Id: I3800f4bf7174b85aab747f0c7fe911acac033383
This commit is contained in:
Sean Dague
2013-05-06 17:46:36 -04:00
parent 66fb3fbc78
commit 8340199178
3 changed files with 9 additions and 25 deletions

View File

@@ -164,6 +164,9 @@ catalog_type = image
# The version of the OpenStack Images API to use
api_version = 1
# HTTP image to use for glance http image testing
http_image = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-uec.tar.gz
[network]
# This section contains configuration options used when executing tests
# against the OpenStack Network API.

View File

@@ -243,7 +243,11 @@ ImageGroup = [
help="Version of the API"),
cfg.StrOpt('catalog_type',
default='image',
help='Catalog type of the Image service.')
help='Catalog type of the Image service.'),
cfg.StrOpt('http_image',
default='http://download.cirros-cloud.net/0.3.1/'
'cirros-0.3.1-x86_64-uec.tar.gz',
help='http accessable image')
]

View File

@@ -81,32 +81,10 @@ class CreateRegisterImagesTest(base.BaseV1ImageTest):
self.assertEqual(properties['key2'], 'value2')
def test_register_http_image(self):
container_client = self.os.container_client
object_client = self.os.object_client
container_name = "image_container"
object_name = "test_image.img"
container_client.create_container(container_name)
self.addCleanup(container_client.delete_container, container_name)
cont_headers = {'X-Container-Read': '.r:*'}
resp, _ = container_client.update_container_metadata(
container_name,
metadata=cont_headers,
metadata_prefix='')
self.assertEqual(resp['status'], '204')
data = "TESTIMAGE"
resp, _ = object_client.create_object(container_name,
object_name, data)
self.addCleanup(object_client.delete_object, container_name,
object_name)
self.assertEqual(resp['status'], '201')
object_url = '/'.join((object_client.base_url,
container_name,
object_name))
resp, body = self.create_image(name='New Http Image',
container_format='bare',
disk_format='raw', is_public=True,
copy_from=object_url)
copy_from=self.config.images.http_image)
self.assertTrue('id' in body)
image_id = body.get('id')
self.created_images.append(image_id)
@@ -115,7 +93,6 @@ class CreateRegisterImagesTest(base.BaseV1ImageTest):
self.client.wait_for_image_status(image_id, 'active')
resp, body = self.client.get_image(image_id)
self.assertEqual(resp['status'], '200')
self.assertEqual(body, data)
@attr(type='image')
def test_register_image_with_min_ram(self):