Before making any changes to the database schema, I created this functional test:
def test_size_greater_2G(self):
"""
A test against the actual datastore backend for the registry
to ensure that the image size property is not truncated.
# 1. POST /images with public image named Image1
# attribute and a size of 5G. Use the HTTP engine with an
# X-Image-Meta-Location attribute to make Glance forego
# "adding" the image data.
# Verify a 200 OK is returned
cmd = ("curl -i -X POST "
"-H 'Expect: ' " # Necessary otherwise sends 100 Continue
"-H 'X-Image-Meta-Location: http://example.com/fakeimage' "
"-H 'X-Image-Meta-Size: %d' "
"-H 'X-Image-Meta-Name: Image1' "
"-H 'X-Image-Meta-Is-Public: True' "
"http://0.0.0.0:%d/images") % (FIVE_GB, api_port)
# 2. HEAD /images
# Verify image size is what was passed in, and not truncated
cmd = "curl -i -X HEAD http://0.0.0.0:%d/images/1" % api_port
exitcode, out, err = execute(cmd)
self.assertEqual(0, exitcode)
lines = out.split("\r\n")
status_line = lines[0]
self.assertEqual("HTTP/1.1 200 OK", status_line) self.assertTrue("X-Image-Meta-Name: Image1" in out) self.assertTrue("X-Image-Meta-Size: %d" % FIVE_GB in out)
I got a pass on this test without any changes to the schema. Perhaps it's due to me being on a 64-bit machine, though, which makes SQLite's Integer columns 64-bit wide?
Donal, could you add that above test case to /tests/functional/test_curl_api.py and run on your machine? Let me know the results. Thanks!
Before making any changes to the database schema, I created this functional test:
def test_size_ greater_ 2G(self) :
"""
A test against the actual datastore backend for the registry
to ensure that the image size property is not truncated.
:see https:/ /bugs.launchpad .net/glance/ +bug/739433
"""
api_port, reg_port, conf_file = self.start_
# 1. POST /images with public image named Image1 Meta-Location attribute to make Glance forego Meta-Location: http:// example. com/fakeimage' " Meta-Is- Public: True' " 0.0.0.0:%d/images") % (FIVE_GB, api_port)
# attribute and a size of 5G. Use the HTTP engine with an
# X-Image-
# "adding" the image data.
# Verify a 200 OK is returned
cmd = ("curl -i -X POST "
"-H 'Expect: ' " # Necessary otherwise sends 100 Continue
"-H 'X-Image-
"-H 'X-Image-Meta-Size: %d' "
"-H 'X-Image-Meta-Name: Image1' "
"-H 'X-Image-
"http://
exitcode, out, err = execute(cmd)
self.assertEqu al(0, exitcode)
lines = out.split("\r\n")
status_line = lines[0]
# 2. HEAD /images 0.0.0.0:%d/images/1" % api_port
# Verify image size is what was passed in, and not truncated
cmd = "curl -i -X HEAD http://
exitcode, out, err = execute(cmd)
lines = out.split("\r\n")
status_line = lines[0]
I got a pass on this test without any changes to the schema. Perhaps it's due to me being on a 64-bit machine, though, which makes SQLite's Integer columns 64-bit wide?
Donal, could you add that above test case to /tests/ functional/ test_curl_ api.py and run on your machine? Let me know the results. Thanks!