From 8340199178d8113dc35273e0310596e99c8fa829 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 6 May 2013 17:46:36 -0400 Subject: [PATCH] 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 --- etc/tempest.conf.sample | 3 +++ tempest/config.py | 6 +++++- tempest/tests/image/v1/test_images.py | 25 +------------------------ 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample index ac18490287..0e07a7757b 100644 --- a/etc/tempest.conf.sample +++ b/etc/tempest.conf.sample @@ -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. diff --git a/tempest/config.py b/tempest/config.py index 556e2a71c0..aea356376b 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -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') ] diff --git a/tempest/tests/image/v1/test_images.py b/tempest/tests/image/v1/test_images.py index c01aeafad5..19c0aa04e5 100644 --- a/tempest/tests/image/v1/test_images.py +++ b/tempest/tests/image/v1/test_images.py @@ -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):