[PATCH][Kimchi 2/2] Add test case to test new slots value implementation

Adds new test case to check if a new VM has the right slot value. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- tests/test_vmtemplate.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_vmtemplate.py b/tests/test_vmtemplate.py index 97c69ec..74816ef 100644 --- a/tests/test_vmtemplate.py +++ b/tests/test_vmtemplate.py @@ -25,7 +25,7 @@ import uuid from wok.xmlutils.utils import xpath_get_text -from wok.plugins.kimchi.osinfo import get_template_default +from wok.plugins.kimchi.osinfo import get_template_default, MEM_DEV_SLOTS from wok.plugins.kimchi.vmtemplate import VMTemplate DISKS = [{'size': 10, 'format': 'raw', 'index': 0, 'pool': {'name': @@ -87,6 +87,15 @@ class VMTemplateTests(unittest.TestCase): self.assertEquals(graphics['type'], t.info['graphics']['type']) self.assertEquals('127.0.0.1', t.info['graphics']['listen']) + def test_mem_dev_slots(self): + vm_uuid = str(uuid.uuid4()).replace('-', '') + t = VMTemplate({'name': 'test-template', 'cdrom': self.iso, + 'memory': {'current': 2048, 'maxmemory': 3072}}) + xml = t.to_vm_xml('test-vm', vm_uuid) + expr = "/domain/maxMemory/@slots" + slots = str(MEM_DEV_SLOTS[os.uname()[4]]) + self.assertEquals(slots, xpath_get_text(xml, expr)[0]) + def test_to_xml(self): graphics = {'type': 'spice', 'listen': '127.0.0.1'} vm_uuid = str(uuid.uuid4()).replace('-', '') -- 2.1.0
participants (1)
-
Rodrigo Trujillo