[Kimchi-devel] [PATCH 4/4] vmiface update support: update test case
Aline Manera
alinefm at linux.vnet.ibm.com
Tue Apr 22 16:05:53 UTC 2014
On 04/18/2014 09:47 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> update test_model.py and test_rest.py
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
> tests/test_model.py | 8 ++++++++
> tests/test_rest.py | 8 ++++++++
> 2 files changed, 16 insertions(+)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index 357d969..6603d9e 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -170,6 +170,14 @@ class ModelTests(unittest.TestCase):
> self.assertEquals("test-network", iface['network'])
> self.assertEquals("virtio", iface["model"])
>
> + # update vm interface
> + iface_args = {"network": "default",
> + "model": "e1000"}
> + inst.vmiface_update('kimchi-ifaces', mac, iface_args)
> + iface = inst.vmiface_lookup('kimchi-ifaces', mac)
> + self.assertEquals("default", iface['network'])
> + self.assertEquals("e1000", iface["model"])
> +
Please, add a test to update vm iface in a running VM.
> @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
> def test_vm_cdrom(self):
> inst = model.Model(objstore_loc=self.tmp_store)
> diff --git a/tests/test_rest.py b/tests/test_rest.py
> index a40ba93..35fa08b 100644
> --- a/tests/test_rest.py
> +++ b/tests/test_rest.py
> @@ -500,6 +500,14 @@ class RestTests(unittest.TestCase):
> self.assertEquals('virtio', iface['model'])
> self.assertEquals('network', iface['type'])
>
> + # update vm interface
> + req = json.dumps({"network": "default", "model": "e1000"})
> + resp = self.request('/vms/test-vm/ifaces/%s' % iface['mac'], req, 'PUT')
> + self.assertEquals(200, resp.status)
> + update_iface = json.loads(resp.read())
> + self.assertEquals('e1000', update_iface['model'])
> + self.assertEquals('default', update_iface['network'])
> +
> # detach network interface from vm
> resp = self.request('/vms/test-vm/ifaces/%s' % iface['mac'],
> '{}', 'DELETE')
More information about the Kimchi-devel
mailing list