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

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Fri Sep 26 09:05:00 UTC 2014


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

v1>v2, use wait task rather than adding sleep time (Cristian)

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      | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

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..99f2176 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -1947,9 +1947,10 @@ class RestTests(unittest.TestCase):
 
             self.assertEquals(r.status_code, 202)
             task = r.json()
-            self._wait_task(task['id'])
+            self._wait_task(task['id'], 15)
             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