[Kimchi-devel] [PATCH] [Kimchi] Fix test case: Proper check memory and cpu_info information

Lucio Correia luciojhc at linux.vnet.ibm.com
Wed Mar 2 20:43:09 UTC 2016


Reviewed-By: Lucio Correia <luciojhc at linux.vnet.ibm.com>

On 02-03-2016 15:38, Aline Manera wrote:
> memory and cpu_info are a dict in which user can update only one value.
> So update the test case to cover it as only one value is being updated
> for memory and cpu_info, ie, the other ones keep the same.
>
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>   tests/test_rest.py | 11 ++++++++---
>   1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/tests/test_rest.py b/tests/test_rest.py
> index 4926126..d0d2fcf 100644
> --- a/tests/test_rest.py
> +++ b/tests/test_rest.py
> @@ -237,18 +237,23 @@ class RestTests(unittest.TestCase):
>           resp = self.request('/plugins/kimchi/vms/vm-1', req, 'PUT')
>           self.assertEquals(400, resp.status)
>
> +        vm = json.loads(
> +            self.request('/plugins/kimchi/vms/vm-1', req).read()
> +        )
>           params = {'name': u'∨м-црdαtеd', 'cpu_info': {'vcpus': 5},
>                     'memory': {'current': 3072}}
>           req = json.dumps(params)
>           resp = self.request('/plugins/kimchi/vms/vm-1', req, 'PUT')
>           self.assertEquals(303, resp.status)
> -        vm = json.loads(
> +        vm_updated = json.loads(
>               self.request('/plugins/kimchi/vms/∨м-црdαtеd', req).read()
>           )
>           # Memory was hot plugged
> -        params['memory']['current'] += 1024
> +        vm['name'] = u'∨м-црdαtеd'
> +        vm['cpu_info'].update(params['cpu_info'])
> +        vm['memory'].update(params['memory'])
>           for key in params.keys():
> -            self.assertEquals(params[key], vm[key])
> +            self.assertEquals(vm[key], vm_updated[key])
>
>           # change only VM users - groups are not changed (default is empty)
>           resp = self.request('/plugins/kimchi/users', '{}', 'GET')
>


-- 
Lucio Correia
Software Engineer
IBM LTC Brazil




More information about the Kimchi-devel mailing list