[PATCH 0/3] Some fixes for Kimchi

Aline Manera (3): Fix issue #734: Update test case as libvirt issue was fixed Fix test case: Delete directory associated to the storage pool Kimchi: Add m4/pkg.m4 to .gitignore src/wok/plugins/kimchi/.gitignore | 1 + src/wok/plugins/kimchi/tests/test_model_storagepool.py | 6 ++++-- .../plugins/kimchi/tests/test_model_storagevolume.py | 17 +++++------------ 3 files changed, 10 insertions(+), 14 deletions(-) -- 2.5.0

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

When creating a DIR storage pool using Model, a directory is created in the system. It should be deleted after running the test case to avoid leaving leftovers in the system and future problems when running the test case multiple times. So do it. Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/tests/test_model_storagepool.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wok/plugins/kimchi/tests/test_model_storagepool.py b/src/wok/plugins/kimchi/tests/test_model_storagepool.py index 5f9b966..ef28bda 100644 --- a/src/wok/plugins/kimchi/tests/test_model_storagepool.py +++ b/src/wok/plugins/kimchi/tests/test_model_storagepool.py @@ -20,6 +20,7 @@ import json import os +import shutil import tempfile import unittest from functools import partial @@ -72,11 +73,12 @@ class StoragepoolTests(unittest.TestCase): # Now add a couple of storage pools for i in xrange(3): name = u'kīмсhī-storagepool-%i' % i - req = json.dumps({'name': name, 'type': 'dir', - 'path': '/var/lib/libvirt/images/%i' % i}) + path = '/var/lib/libvirt/images/%i' % i + req = json.dumps({'name': name, 'type': 'dir', 'path': path}) resp = self.request('/plugins/kimchi/storagepools', req, 'POST') rollback.prependDefer(model.storagepool_delete, name) + rollback.prependDefer(shutil.rmtree, path) self.assertEquals(201, resp.status) -- 2.5.0

Signed-off-by: Aline Manera <alinefm@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wok/plugins/kimchi/.gitignore b/src/wok/plugins/kimchi/.gitignore index 1dae610..0cd7265 100644 --- a/src/wok/plugins/kimchi/.gitignore +++ b/src/wok/plugins/kimchi/.gitignore @@ -8,6 +8,7 @@ autom4te.cache Makefile Makefile.in aclocal.m4 +m4/pkg.m4 build-aux/compile build-aux/config.guess build-aux/config.sub -- 2.5.0

Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> On 11/12/2015 05:32 PM, Aline Manera wrote:
Aline Manera (3): Fix issue #734: Update test case as libvirt issue was fixed Fix test case: Delete directory associated to the storage pool Kimchi: Add m4/pkg.m4 to .gitignore
src/wok/plugins/kimchi/.gitignore | 1 + src/wok/plugins/kimchi/tests/test_model_storagepool.py | 6 ++++-- .../plugins/kimchi/tests/test_model_storagevolume.py | 17 +++++------------ 3 files changed, 10 insertions(+), 14 deletions(-)
participants (2)
-
Aline Manera
-
Rodrigo Trujillo