[Kimchi-devel] [PATCH v2 01/10] Update clone test
Crístian Viana
vianac at linux.vnet.ibm.com
Wed Nov 12 19:12:03 UTC 2014
The clone model test assumes that the default VM is running so it can
expect an exception when trying to clone that VM. But that's not always
the case. Also, the test doesn't wait for the clone operation to finish,
which sometimes may cause an error.
Make sure the VM used in the test is running before cloning it
(expecting an exception) and wait for the clone task to finish before
moving on to the next test.
Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
tests/test_model.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/test_model.py b/tests/test_model.py
index f4d842f..4e0c837 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -1262,6 +1262,8 @@ class ModelTests(unittest.TestCase):
name = all_vm_names[0]
original_vm = inst.vm_lookup(name)
+ if original_vm['state'] == u'shutoff':
+ inst.vm_start(name)
# the VM 'test' should be running by now, so we can't clone it yet
self.assertRaises(InvalidParameter, inst.vm_clone, name)
@@ -1274,6 +1276,8 @@ class ModelTests(unittest.TestCase):
clone_name = task['target_uri'].split('/')[-1]
rollback.prependDefer(inst.vm_delete, clone_name)
inst.task_wait(task['id'])
+ task = inst.task_lookup(task['id'])
+ self.assertEquals('finished', task['status'])
# update the original VM info because its state has changed
original_vm = inst.vm_lookup(name)
--
1.9.3
More information about the Kimchi-devel
mailing list