[Kimchi-devel] [PATCH] tests/test_osinfo.py: fixes for Power architecture

Daniel Henrique Barboza dhbarboza82 at gmail.com
Fri Mar 13 15:49:06 UTC 2015


- osinfo tests weren't considering config differences between
x86 and Power archs, resulting in errors.

- a new test was added to explictly test the case where an
unknown distro/version should return the configuration of
an old distro/version after the lookup.

Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
 tests/test_osinfo.py | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/tests/test_osinfo.py b/tests/test_osinfo.py
index d5e90b4..f2837f0 100644
--- a/tests/test_osinfo.py
+++ b/tests/test_osinfo.py
@@ -30,13 +30,23 @@ class OSInfoTests(unittest.TestCase):
         self.assertEquals('unknown', entry['os_version'])
         self.assertEquals(['default'], entry['networks'])
 
+    def _check_old_distro_diskbus_nic_multi_arch(self, disk_bus, nic_model):
+        if _get_arch() == 'x86':
+            self.assertEquals(disk_bus, 'ide')
+            self.assertEquals(nic_model, 'e1000')
+        else:
+            self.assertEquals(disk_bus, 'scsi')
+            self.assertEquals(nic_model, 'spapr-vlan')
+
     def test_old_distros(self):
         old_versions = {'debian': '5.0', 'ubuntu': '7.04', 'opensuse': '10.1',
                         'centos': '5.1', 'rhel': '5.1', 'fedora': '15'}
         for distro, version in old_versions.iteritems():
             entry = lookup(distro, version)
-            self.assertEquals(entry['disk_bus'], 'ide')
-            self.assertEquals(entry['nic_model'], 'e1000')
+            self._check_old_distro_diskbus_nic_multi_arch(
+                entry['disk_bus'],
+                entry['nic_model']
+            )
 
     def test_modern_bases(self):
         for distro, version in modern_version_bases[_get_arch()].iteritems():
@@ -45,10 +55,19 @@ class OSInfoTests(unittest.TestCase):
             self.assertEquals(entry['nic_model'], 'virtio')
 
     def test_modern_distros(self):
-        modern_versions = {'debian': '7.0', 'ubuntu': '12.04',
-                           'opensuse': '12.3', 'centos': '6.4', 'rhel': '6.3',
-                           'fedora': '18', 'gentoo': '12.1'}
+        # versions based on ppc64 modern distros
+        modern_versions = {'ubuntu': '14.04', 'opensuse': '13.1',
+                           'rhel': '6.5', 'fedora': '19', 'sles': '11sp3'}
         for distro, version in modern_versions.iteritems():
             entry = lookup(distro, version)
             self.assertEquals(entry['disk_bus'], 'virtio')
             self.assertEquals(entry['nic_model'], 'virtio')
+
+    def test_lookup_unknown_distro_version_returns_old_distro(self):
+        distro = 'unknown_distro'
+        version = 'unknwon_version'
+        entry = lookup(distro, version)
+        self._check_old_distro_diskbus_nic_multi_arch(
+            entry['disk_bus'],
+            entry['nic_model']
+        )
-- 
1.9.3




More information about the Kimchi-devel mailing list