[Kimchi-devel] [PATCH v4] [Kimchi 8/8] Add test case for the socket server
Jose Ricardo Ziviani
joserz at linux.vnet.ibm.com
Fri Feb 12 17:35:45 UTC 2016
Signed-off-by: Jose Ricardo Ziviani <joserz at linux.vnet.ibm.com>
---
tests/test_model.py | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/tests/test_model.py b/tests/test_model.py
index f2ec461..097c2d6 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -137,10 +137,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')
@@ -325,6 +325,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)
--
1.9.1
More information about the Kimchi-devel
mailing list