
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 25/03/2015 07:15, Daniel Henrique Barboza wrote:
- test_vm_disk now uses osinfo 'get_template_default' to get the default value for 'disk_bus'.
- kimchi_iso now generates a Ubuntu 14.04 fake iso to allow modern Power template in the tests (Ubuntu 12.04 is not considered a modern distro for Power).
- iso_gen.py was updated to allow the creation of Ubuntu 14.04 fake isos.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- tests/iso_gen.py | 3 ++- tests/test_model.py | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/tests/iso_gen.py b/tests/iso_gen.py index 5a0262f..096161d 100644 --- a/tests/iso_gen.py +++ b/tests/iso_gen.py @@ -48,7 +48,8 @@ iso_des = [ ('debian', lambda v: True, lambda v: 'Debian %s' % v), ('ubuntu', lambda v: v in ('7.10', '8.04', '8.10', '9.04', '9.10', '10.04', '10.10', - '11.04', '11.10', '12.04', '12.10', '13.04', '13.10'), + '11.04', '11.10', '12.04', '12.10', '13.04', '13.10', + '14.04'), lambda v: 'Ubuntu %s' % v), ('fedora', lambda v: v in ('16', '17', '18', '19'), diff --git a/tests/test_model.py b/tests/test_model.py index 0020022..63bd721 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -41,6 +41,7 @@ from kimchi.basemodel import Singleton from kimchi.config import config from kimchi.exception import InvalidOperation from kimchi.exception import InvalidParameter, NotFoundError, OperationFailed +from kimchi.osinfo import get_template_default from kimchi.model import model from kimchi.model.libvirtconnection import LibvirtConnection from kimchi.rollbackcontext import RollbackContext @@ -53,14 +54,14 @@ invalid_repository_urls = ['www.fedora.org', # missing protocol 'file:///home/foobar'] # invalid path
ISO_PATH = '/tmp/kimchi-model-iso/' -UBUNTU_ISO = ISO_PATH + 'ubuntu12.04.iso' +UBUNTU_ISO = ISO_PATH + 'ubuntu14.04.iso'
def setUpModule(): if not os.path.exists(ISO_PATH): os.makedirs(ISO_PATH)
- iso_gen.construct_fake_iso(UBUNTU_ISO, True, '12.04', 'ubuntu') + iso_gen.construct_fake_iso(UBUNTU_ISO, True, '14.04', 'ubuntu')
# Some FeatureTests functions depend on server to validate their result. # As CapabilitiesModel is a Singleton class it will get the first result @@ -354,8 +355,9 @@ class ModelTests(unittest.TestCase): def test_vm_disk(self): disk_path = '/tmp/existent2.iso' open(disk_path, 'w').close() + modern_disk_bus = get_template_default('modern', 'disk_bus')
- def _attach_disk(expect_bus='virtio'): + def _attach_disk(expect_bus=modern_disk_bus): disk_args = {"type": "disk", "pool": pool, "vol": vol} @@ -449,8 +451,8 @@ class ModelTests(unittest.TestCase): inst.vms_create(params) rollback.prependDefer(inst.vm_delete, vm_name)
- # Attach will choose IDE bus for old distro - disk = _attach_disk('ide') + # Need to check the right disk_bus for old distro + disk = _attach_disk(get_template_default('old', 'disk_bus')) inst.vmstorage_delete('kimchi-ide-bus-vm', disk)
# Hot plug IDE bus disk does not work