[Kimchi-devel] [PATCH 2/3] model test for updating template
Christy Perez
christy at linux.vnet.ibm.com
Thu Oct 23 21:07:51 UTC 2014
Somehow I only just got Aline's message about mockmodel.py, so I suppose
disregard this for now, and I'll look at that too.
On 10/23/2014 03:57 PM, Christy Perez wrote:
> Signed-off-by: Christy Perez <christy at linux.vnet.ibm.com>
> ---
> tests/test_model.py | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index e407fe5..b759667 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -800,6 +800,31 @@ def test_template_update(self):
> self.assertRaises(InvalidParameter, inst.template_update,
> 'new-test', params)
>
> + @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
> + def test_template_update_cpu_info(self):
> + inst = model.Model(None,
> + objstore_loc=self.tmp_store)
> + with RollbackContext() as rollback:
> +
> + params = {'name': 'test', 'memory': 1024, 'cpus': 1,
> + 'cdrom': self.kimchi_iso}
> + inst.templates_create(params)
> + rollback.prependDefer(inst.template_delete, 'test')
> +
> + # topology and cpus aren't compatible:
> + params['cpu_info'] = {'topology':
> + {'sockets': 1, 'cores': 1, 'threads': 2}}
> + self.assertRaises(InvalidParameter, inst.template_update, 'test',\
> + params)
> +
> + # Now the update should work:
> + params['cpus'] = 2
> + inst.template_update('test', params)
> +
> + info = inst.template_lookup('test')
> + for key in params.keys():
> + self.assertEquals(params[key], info[key])
> +
> def test_vm_edit(self):
> inst = model.Model(None,
> objstore_loc=self.tmp_store)
>
More information about the Kimchi-devel
mailing list