Skip to content

Commit

Permalink
Replace example.com with localhost for some tests
Browse files Browse the repository at this point in the history
Fix for LP Bug #1025756.

When running the unit tests on a system without a
direct internet connection some tests run slowly.
Replacing example.com with localhost:0 speeds up
the relevant tests.

Change-Id: Iac6fc506b1d36b18ab21bb956ec2d8acc004bba8
  • Loading branch information
Stuart McLaren committed Jul 18, 2012
1 parent 9aa4d92 commit 251c5e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions glance/tests/functional/test_bin_glance.py
Expand Up @@ -139,7 +139,7 @@ def test_add_with_location(self):
# 1. Add public image
cmd = minimal_add_command(api_port,
'MyImage',
'location=http://example.com')
'location=http://localhost:0')
exitcode, out, err = execute(cmd)

self.assertEqual(0, exitcode)
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_add_no_name(self):
# name...
cmd = ("bin/glance --port=%d add is_public=True"
" disk_format=raw container_format=ovf"
" %s" % (api_port, 'location=http://example.com'))
" %s" % (api_port, 'location=http://localhost:0'))
exitcode, out, err = execute(cmd)

self.assertEqual(0, exitcode)
Expand Down Expand Up @@ -338,7 +338,7 @@ def test_add_with_location_and_stdin(self):
file_name = image_file.name
cmd = minimal_add_command(api_port,
'MyImage',
'location=http://example.com < %s' %
'location=http://localhost:0 < %s' %
file_name)
exitcode, out, err = execute(cmd)

Expand Down Expand Up @@ -470,7 +470,7 @@ def test_add_list_update_list(self):
# 1. Add public image
cmd = minimal_add_command(api_port,
'MyImage',
'location=http://example.com',
'location=http://localhost:0',
public=False)

exitcode, out, err = execute(cmd)
Expand Down Expand Up @@ -602,7 +602,7 @@ def test_add_location_with_checksum(self):
# 1. Add public image
cmd = minimal_add_command(api_port,
'MyImage',
'location=http://example.com checksum=1')
'location=http://localhost:0 checksum=1')
exitcode, out, err = execute(cmd)

self.assertEqual(0, exitcode)
Expand Down Expand Up @@ -633,7 +633,7 @@ def test_add_location_without_checksum(self):
# 1. Add public image
cmd = minimal_add_command(api_port,
'MyImage',
'location=http://example.com')
'location=http://localhost:0')
exitcode, out, err = execute(cmd)

self.assertEqual(0, exitcode)
Expand Down
8 changes: 4 additions & 4 deletions glance/tests/unit/v1/test_api.py
Expand Up @@ -2025,7 +2025,7 @@ def destroy_fixtures(self):

def _do_test_defaulted_format(self, format_key, format_value):
fixture_headers = {'x-image-meta-name': 'defaulted',
'x-image-meta-location': 'http://foo.com/image',
'x-image-meta-location': 'http://localhost:0/image',
format_key: format_value}

req = webob.Request.blank("/images")
Expand All @@ -2048,7 +2048,7 @@ def test_defaulted_amazon_format(self):
def test_bad_disk_format(self):
fixture_headers = {'x-image-meta-store': 'bad',
'x-image-meta-name': 'bogus',
'x-image-meta-location': 'http://example.com/image.tar.gz',
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
'x-image-meta-disk-format': 'invalid',
'x-image-meta-container-format': 'ami'}

Expand All @@ -2064,7 +2064,7 @@ def test_bad_disk_format(self):
def test_bad_container_format(self):
fixture_headers = {'x-image-meta-store': 'bad',
'x-image-meta-name': 'bogus',
'x-image-meta-location': 'http://example.com/image.tar.gz',
'x-image-meta-location': 'http://localhost:0/image.tar.gz',
'x-image-meta-disk-format': 'vhd',
'x-image-meta-container-format': 'invalid'}

Expand Down Expand Up @@ -2117,7 +2117,7 @@ def test_add_image_no_location_no_image_as_body(self):

req = webob.Request.blank("/images/%s" % image_id)
req.method = 'PUT'
req.headers['x-image-meta-location'] = 'http://example.com/images/123'
req.headers['x-image-meta-location'] = 'http://localhost:0/images/123'
res = req.get_response(self.api)
self.assertEquals(res.status_int, httplib.OK)

Expand Down

0 comments on commit 251c5e5

Please sign in to comment.