[Kimchi-devel] [PATCH] Fix: accelerate mockmodel for file upload

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Thu Sep 25 11:12:13 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

File upload fails with error 404 because of small read is time consuming,
change read size and wait in test to guarentee storage volume
created when query URI.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/mockmodel.py | 2 +-
 tests/test_rest.py      | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index ab4357d..cbbdba3 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -534,7 +534,7 @@ class MockModel(object):
         size = 0
         try:
             while True:
-                data = upload_file.file.read(8192)
+                data = upload_file.file.read(8192*32)
                 if not data:
                         break
                 size += len(data)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 7eb6233..fa44985 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1948,8 +1948,10 @@ class RestTests(unittest.TestCase):
             self.assertEquals(r.status_code, 202)
             task = r.json()
             self._wait_task(task['id'])
+            time.sleep(5)
             resp = self.request('/storagepools/default/storagevolumes/%s' %
                                 task['target_uri'].split('/')[-1])
+
             self.assertEquals(200, resp.status)
 
             # Create a file with 5M to upload
-- 
1.8.3.2




More information about the Kimchi-devel mailing list