[Kimchi-devel] [PATCH] [Kimchi 2/2] Remove test for HTTP error 413

Aline Manera alinefm at linux.vnet.ibm.com
Mon Feb 20 14:10:34 UTC 2017



On 02/09/2017 03:05 PM, Lucio Correia wrote:
> Python requests httplib is not prepared to handle 413 errors
> as required by Cherrypy like nginx is, thus it will not return
> error 413 when HTTP request data is bigger than max_body_size.

I understand the problem but the solution is not remove the test case IMO.
We should fix the test case according to httplib limitation and keep 
validating max body size is proper set.

> Signed-off-by: Lucio Correia <luciojhc at linux.vnet.ibm.com>
> ---
>   tests/test_model_storagevolume.py | 20 --------------------
>   1 file changed, 20 deletions(-)
>
> diff --git a/tests/test_model_storagevolume.py b/tests/test_model_storagevolume.py
> index 638751a..b1d03dd 100644
> --- a/tests/test_model_storagevolume.py
> +++ b/tests/test_model_storagevolume.py
> @@ -173,26 +173,6 @@ def _do_volume_test(self, model, pool_name):
>               # Upload volume content
>               url = 'http://%s:%s' % (HOST, PORT) + uri + '/' + filename
>
> -            # Create a file with 5M to upload
> -            # Max body size is set to 4M so the upload will fail with 413
> -            newfile = '/tmp/5m-file'
> -            with open(newfile, 'wb') as fd:
> -                fd.seek(5*1024*1024-1)
> -                fd.write("\0")
> -            rollback.prependDefer(os.remove, newfile)
> -
> -            with open(newfile, 'rb') as fd:
> -                with open(newfile + '.tmp', 'wb') as tmp_fd:
> -                    data = fd.read()
> -                    tmp_fd.write(data)
> -
> -                with open(newfile + '.tmp', 'rb') as tmp_fd:
> -                    r = requests.put(url, data={'chunk_size': len(data)},
> -                                     files={'chunk': tmp_fd},
> -                                     verify=False,
> -                                     headers=fake_auth_header())
> -                    self.assertEquals(r.status_code, 413)
> -
>               # Do upload
>               index = 0
>               chunk_size = 2 * 1024



More information about the Kimchi-devel mailing list