[Kimchi-devel] [PATCH 1/3] Fix issue #734: Update test case as libvirt issue was fixed

Aline Manera alinefm at linux.vnet.ibm.com
Thu Nov 12 19:32:40 UTC 2015


Due a libvirt bug it was not possible to decrease the storage volume capacity,
so the test case was updated accordingly.
As libvirt bug is fixed now, remove the hack in the test case.
For distros using older libvirt version, the test case may fail but the
error can be safely ignored.

For reference: https://bugzilla.redhat.com/show_bug.cgi?id=1021802

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 .../plugins/kimchi/tests/test_model_storagevolume.py    | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/wok/plugins/kimchi/tests/test_model_storagevolume.py b/src/wok/plugins/kimchi/tests/test_model_storagevolume.py
index 087dd7b..b387c31 100644
--- a/src/wok/plugins/kimchi/tests/test_model_storagevolume.py
+++ b/src/wok/plugins/kimchi/tests/test_model_storagevolume.py
@@ -28,7 +28,6 @@ from wok.config import paths
 from wok.rollbackcontext import RollbackContext
 
 from wok.plugins.kimchi.config import READONLY_POOL_TYPE
-from wok.plugins.kimchi.mockmodel import MockModel
 from wok.plugins.kimchi.model.model import Model
 
 from utils import fake_auth_header, get_free_port, patch_auth, request
@@ -107,19 +106,13 @@ def _do_volume_test(self, model, host, ssl_port, pool_name):
             self.assertEquals(2147483648, storagevolume['capacity'])
 
             # Resize the storage volume: decrease its capacity to 512 MiB
-            # FIXME: Due a libvirt bug it is not possible to decrease the
-            # volume capacity
-            # For reference:
-            # - https://bugzilla.redhat.com/show_bug.cgi?id=1021802
+            # This test case may fail if libvirt does not include the fix for
+            # https://bugzilla.redhat.com/show_bug.cgi?id=1021802
             req = json.dumps({'size': 536870912})  # 512 MiB
             resp = self.request(vol_uri + '/resize', req, 'POST')
-            # It is only possible when using MockModel
-            if isinstance(model, MockModel):
-                self.assertEquals(200, resp.status)
-                storagevolume = json.loads(self.request(vol_uri).read())
-                self.assertEquals(536870912, storagevolume['capacity'])
-            else:
-                self.assertEquals(500, resp.status)
+            self.assertEquals(200, resp.status)
+            storagevolume = json.loads(self.request(vol_uri).read())
+            self.assertEquals(536870912, storagevolume['capacity'])
 
             # Wipe the storage volume
             resp = self.request(vol_uri + '/wipe', '{}', 'POST')
-- 
2.5.0




More information about the Kimchi-devel mailing list