[Kimchi-devel] [PATCH] test/vmtemplate.py: fixes for Power architecture

Daniel Henrique Barboza dhbarboza82 at gmail.com
Fri Mar 13 20:51:29 UTC 2015


- changing 'fields' variable to a dict instead of an array
to manipulate specific fields easier

- changing 'memory', 'disk_bus' and 'nic_model' fields
when running the tests in a Power host

Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
 tests/test_vmtemplate.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/tests/test_vmtemplate.py b/tests/test_vmtemplate.py
index 550bb2a..372f54a 100644
--- a/tests/test_vmtemplate.py
+++ b/tests/test_vmtemplate.py
@@ -22,6 +22,7 @@ import unittest
 import uuid
 
 
+from kimchi.osinfo import _get_arch
 from kimchi.vmtemplate import VMTemplate
 from kimchi.xmlutils.utils import xpath_get_text
 
@@ -35,16 +36,21 @@ class VMTemplateTests(unittest.TestCase):
         os.unlink(self.iso)
 
     def test_minimal_construct(self):
-        fields = (('name', 'test'), ('os_distro', 'unknown'),
-                  ('os_version', 'unknown'), ('cpus', 1),
-                  ('memory', 1024), ('networks', ['default']),
-                  ('disk_bus', 'ide'), ('nic_model', 'e1000'),
-                  ('graphics', {'type': 'vnc', 'listen': '127.0.0.1'}),
-                  ('cdrom', self.iso))
+        fields = {'name': 'test', 'os_distro': 'unknown',
+                  'os_version': 'unknown', 'cpus': 1,
+                  'memory': 1024, 'networks': ['default'],
+                  'disk_bus': 'ide', 'nic_model': 'e1000',
+                  'graphics': {'type': 'vnc', 'listen': '127.0.0.1'},
+                  'cdrom': self.iso}
+
+        if _get_arch() in ('power', 'ppc64le'):
+            fields['memory'] = 1280
+            fields['disk_bus'] = 'scsi'
+            fields['nic_model'] = 'spapr-vlan'
 
         args = {'name': 'test', 'cdrom': self.iso}
         t = VMTemplate(args)
-        for name, val in fields:
+        for name, val in fields.iteritems():
             self.assertEquals(val, t.info.get(name))
 
     def test_construct_overrides(self):
-- 
1.9.3




More information about the Kimchi-devel mailing list