[Kimchi-devel] [PATCH V3 3/3] Support ppc64 isos in Templates: Fix test cases

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Thu Mar 6 16:07:42 UTC 2014


This patch includes distro test in PPC environment and fixes problems due
to new Fedora distro names, encoding the name.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 tests/test_model.py |  1 +
 tests/test_rest.py  | 33 +++++++++++++++++++++++++++------
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/tests/test_model.py b/tests/test_model.py
index 9df4994..f849039 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -892,6 +892,7 @@ class ModelTests(unittest.TestCase):
             self.assertIn('name', distro)
             self.assertIn('os_distro', distro)
             self.assertIn('os_version', distro)
+            self.assertIn('os_arch', distro)
             self.assertIn('path', distro)
 
     @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
diff --git a/tests/test_rest.py b/tests/test_rest.py
index e5f50ae..1d1a109 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -25,6 +25,7 @@ import random
 import shutil
 import time
 import unittest
+import urllib2
 
 
 from functools import partial
@@ -1423,13 +1424,33 @@ class RestTests(unittest.TestCase):
             self.assertIn('os_version', distro)
             self.assertIn('path', distro)
 
-        ident = "fedora-19"
-        resp = self.request('/config/distros/%s' % ident).read()
+        # Test in X86
+        ident = "Fedora 19"
+        resp = self.request('/config/distros/%s' % urllib2.quote(ident)).read()
         distro = json.loads(resp)
-        self.assertEquals(distro['name'], ident)
-        self.assertEquals(distro['os_distro'], "fedora")
-        self.assertEquals(distro['os_version'], "19")
-        self.assertIn('path', distro)
+        if os.uname()[4] in ['x86_64', 'amd64']:
+            self.assertEquals(distro['name'], ident)
+            self.assertEquals(distro['os_distro'], "fedora")
+            self.assertEquals(distro['os_version'], "19")
+            self.assertEquals(distro['os_arch'], "x86_64")
+            self.assertIn('path', distro)
+        else:
+            # Distro not found error
+            self.assertIn('KCHDISTRO0001E',distro.get('reason'))
+
+        # Test in PPC
+        ident = "Fedora 20 (PPC64)"
+        resp = self.request('/config/distros/%s' % urllib2.quote(ident)).read()
+        distro = json.loads(resp)
+        if os.uname()[4] == 'ppc64':
+            self.assertEquals(distro['name'], ident)
+            self.assertEquals(distro['os_distro'], "fedora")
+            self.assertEquals(distro['os_version'], "20")
+            self.assertEquals(distro['os_arch'], "ppc64")
+            self.assertIn('path', distro)
+        else:
+            # Distro not found error
+            self.assertIn('KCHDISTRO0001E',distro.get('reason'))
 
     def test_debugreports(self):
         resp = request(host, port, '/debugreports')
-- 
1.8.5.3




More information about the Kimchi-devel mailing list