Merge "Fixed intermittent timeout/failing functional tests"
This commit is contained in:
commit
70b9bd93c3
@ -364,6 +364,8 @@ store_type_preference = %(store_type_location_strategy_preference)s
|
|||||||
[glance_store]
|
[glance_store]
|
||||||
filesystem_store_datadir=%(image_dir)s
|
filesystem_store_datadir=%(image_dir)s
|
||||||
default_store = %(default_store)s
|
default_store = %(default_store)s
|
||||||
|
[import_filtering_opts]
|
||||||
|
allowed_ports = []
|
||||||
"""
|
"""
|
||||||
self.paste_conf_base = """[pipeline:glance-api]
|
self.paste_conf_base = """[pipeline:glance-api]
|
||||||
pipeline =
|
pipeline =
|
||||||
@ -549,6 +551,8 @@ default_backend = %(default_backend)s
|
|||||||
filesystem_store_datadir=%(image_dir_backend_1)s
|
filesystem_store_datadir=%(image_dir_backend_1)s
|
||||||
[file2]
|
[file2]
|
||||||
filesystem_store_datadir=%(image_dir_backend_2)s
|
filesystem_store_datadir=%(image_dir_backend_2)s
|
||||||
|
[import_filtering_opts]
|
||||||
|
allowed_ports = []
|
||||||
"""
|
"""
|
||||||
self.paste_conf_base = """[pipeline:glance-api]
|
self.paste_conf_base = """[pipeline:glance-api]
|
||||||
pipeline =
|
pipeline =
|
||||||
|
@ -341,8 +341,11 @@ class TestImages(functional.FunctionalTest):
|
|||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
'X-Roles': 'admin',
|
'X-Roles': 'admin',
|
||||||
})
|
})
|
||||||
image_data_uri = ('https://www.openstack.org/assets/openstack-logo/'
|
|
||||||
'2016R/OpenStack-Logo-Horizontal.eps.zip')
|
# Start http server locally
|
||||||
|
pid, port = test_utils.start_standalone_http_server()
|
||||||
|
|
||||||
|
image_data_uri = 'http://localhost:%s/' % port
|
||||||
data = jsonutils.dumps({'method': {
|
data = jsonutils.dumps({'method': {
|
||||||
'name': 'web-download',
|
'name': 'web-download',
|
||||||
'uri': image_data_uri
|
'uri': image_data_uri
|
||||||
@ -369,6 +372,9 @@ class TestImages(functional.FunctionalTest):
|
|||||||
os_hash_value=expect_h,
|
os_hash_value=expect_h,
|
||||||
status='active')
|
status='active')
|
||||||
|
|
||||||
|
# kill the local http server
|
||||||
|
os.kill(pid, signal.SIGKILL)
|
||||||
|
|
||||||
# Deleting image should work
|
# Deleting image should work
|
||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.delete(path, headers=self._headers())
|
response = requests.delete(path, headers=self._headers())
|
||||||
@ -4901,8 +4907,11 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
|||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
'X-Roles': 'admin',
|
'X-Roles': 'admin',
|
||||||
})
|
})
|
||||||
image_data_uri = ('https://www.openstack.org/assets/openstack-logo/'
|
|
||||||
'2016R/OpenStack-Logo-Horizontal.eps.zip')
|
# Start http server locally
|
||||||
|
pid, port = test_utils.start_standalone_http_server()
|
||||||
|
|
||||||
|
image_data_uri = 'http://localhost:%s/' % port
|
||||||
data = jsonutils.dumps({'method': {
|
data = jsonutils.dumps({'method': {
|
||||||
'name': 'web-download',
|
'name': 'web-download',
|
||||||
'uri': image_data_uri
|
'uri': image_data_uri
|
||||||
@ -4928,6 +4937,9 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
|||||||
checksum=expect_c,
|
checksum=expect_c,
|
||||||
os_hash_value=expect_h,
|
os_hash_value=expect_h,
|
||||||
status='active')
|
status='active')
|
||||||
|
|
||||||
|
# kill the local http server
|
||||||
|
os.kill(pid, signal.SIGKILL)
|
||||||
# Ensure image is created in default backend
|
# Ensure image is created in default backend
|
||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.get(path, headers=self._headers())
|
response = requests.get(path, headers=self._headers())
|
||||||
@ -5055,8 +5067,11 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
|||||||
'X-Roles': 'admin',
|
'X-Roles': 'admin',
|
||||||
'X-Image-Meta-Store': 'file2'
|
'X-Image-Meta-Store': 'file2'
|
||||||
})
|
})
|
||||||
image_data_uri = ('https://www.openstack.org/assets/openstack-logo/'
|
|
||||||
'2016R/OpenStack-Logo-Horizontal.eps.zip')
|
# Start http server locally
|
||||||
|
pid, port = test_utils.start_standalone_http_server()
|
||||||
|
|
||||||
|
image_data_uri = 'http://localhost:%s/' % port
|
||||||
data = jsonutils.dumps({'method': {
|
data = jsonutils.dumps({'method': {
|
||||||
'name': 'web-download',
|
'name': 'web-download',
|
||||||
'uri': image_data_uri
|
'uri': image_data_uri
|
||||||
@ -5082,6 +5097,10 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest):
|
|||||||
checksum=expect_c,
|
checksum=expect_c,
|
||||||
os_hash_value=expect_h,
|
os_hash_value=expect_h,
|
||||||
status='active')
|
status='active')
|
||||||
|
|
||||||
|
# kill the local http server
|
||||||
|
os.kill(pid, signal.SIGKILL)
|
||||||
|
|
||||||
# Ensure image is created in different backend
|
# Ensure image is created in different backend
|
||||||
path = self._url('/v2/images/%s' % image_id)
|
path = self._url('/v2/images/%s' % image_id)
|
||||||
response = requests.get(path, headers=self._headers())
|
response = requests.get(path, headers=self._headers())
|
||||||
|
@ -713,3 +713,28 @@ def is_sqlite_version_prior_to(major, minor):
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
tup = sqlite3.sqlite_version_info
|
tup = sqlite3.sqlite_version_info
|
||||||
return tup[0] < major or (tup[0] == major and tup[1] < minor)
|
return tup[0] < major or (tup[0] == major and tup[1] < minor)
|
||||||
|
|
||||||
|
|
||||||
|
def start_standalone_http_server():
|
||||||
|
def _get_http_handler_class():
|
||||||
|
class StaticHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
|
||||||
|
def do_GET(self):
|
||||||
|
data = b"Hello World!!!"
|
||||||
|
self.send_response(http.OK)
|
||||||
|
self.send_header('Content-Length', str(len(data)))
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(data)
|
||||||
|
return
|
||||||
|
|
||||||
|
return StaticHTTPRequestHandler
|
||||||
|
|
||||||
|
server_address = ('127.0.0.1', 0)
|
||||||
|
handler_class = _get_http_handler_class()
|
||||||
|
httpd = BaseHTTPServer.HTTPServer(server_address, handler_class)
|
||||||
|
port = httpd.socket.getsockname()[1]
|
||||||
|
|
||||||
|
pid = os.fork()
|
||||||
|
if pid == 0:
|
||||||
|
httpd.serve_forever()
|
||||||
|
else:
|
||||||
|
return pid, port
|
||||||
|
Loading…
x
Reference in New Issue
Block a user