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

Lucio Correia luciojhc at linux.vnet.ibm.com
Thu Feb 9 17:05:44 UTC 2017


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.

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
-- 
2.7.4



More information about the Kimchi-devel mailing list