
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> On 02/04/2016 05:47 PM, Jose Ricardo Ziviani wrote:
Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> --- tests/test_model.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py index 762f0f8..1e021e5 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -2,7 +2,7 @@ # # Project Kimchi # -# Copyright IBM, Corp. 2013-2015 +# Copyright IBM, Corp. 2013-2016 # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -136,10 +136,10 @@ class ModelTests(unittest.TestCase): self.assertEquals('finished', task['status']) vol = inst.storagevolume_lookup(u'default', vol_params['name'])
- params = {'name': 'test', 'disks': [{'base': vol['path'], - 'size': 1, 'pool': { - 'name': '/plugins/kimchi/storagepools/default'}}], - 'cdrom': UBUNTU_ISO} + params = {'name': 'test', 'disks': + [{'base': vol['path'], 'size': 1, 'pool': { + 'name': '/plugins/kimchi/storagepools/default'}}], + 'cdrom': UBUNTU_ISO} inst.templates_create(params) rollback.prependDefer(inst.template_delete, 'test')
@@ -324,6 +324,26 @@ class ModelTests(unittest.TestCase):
inst.template_delete('test')
+ @unittest.skipUnless(utils.running_as_root(), "Must be run as root") + def test_vm_serial(self): + inst = model.Model(objstore_loc=self.tmp_store) + params = {'name': 'test', 'disks': [], 'cdrom': UBUNTU_ISO} + inst.templates_create(params) + with RollbackContext() as rollback: + params = {'name': 'kimchi-serial', + 'template': '/plugins/kimchi/templates/test'} + task1 = inst.vms_create(params) + inst.task_wait(task1['id']) + rollback.prependDefer(inst.vm_delete, 'kimchi-serial') + + inst.vm_start('kimchi-serial') + rollback.prependDefer(inst.vm_poweroff, 'kimchi-serial') + + inst.vm_serial('kimchi-serial') + self.assertTrue(os.path.exists('/tmp/kimchi-serial')) + + inst.template_delete('test') + @unittest.skipUnless(utils.running_as_root(), 'Must be run as root') def test_vm_ifaces(self): inst = model.Model(objstore_loc=self.tmp_store)