Signed-off-by: Jose Ricardo Ziviani <joserz(a)linux.vnet.ibm.com>
---
tests/test_config.py.in | 6 ++++++
tests/test_model.py | 28 ++++++++++++++++++++++++----
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/tests/test_config.py.in b/tests/test_config.py.in
index 43a9003..597c61a 100644
--- a/tests/test_config.py.in
+++ b/tests/test_config.py.in
@@ -158,6 +158,12 @@ class ConfigTests(unittest.TestCase):
'tools.staticfile.filename': '%s/ui/config/tab-ext.xml'
%
pluginPrefix,
},
+ '/serial': {
+ 'tools.nocache.on': True,
+ 'tools.wokauth.on': True,
+ 'tools.staticdir.dir': paths.serial_dir,
+ 'tools.staticdir.on': True
+ },
}
kimchi_config = Parser().dict_from_file(KimchiPaths().conf_file)
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