[Kimchi-devel] [kimchi-devel][PATCH 2/2] Fix wrong usage of feature tests

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Tue Feb 3 08:47:07 UTC 2015


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Feature tests qemu_supports_iso_stream() and qemu_iso_stream_dns()
count on running kimchi server to get result,
so it is wrong to use them in model tests.

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 tests/test_model.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/tests/test_model.py b/tests/test_model.py
index f80f1c9..161f705 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -528,15 +528,13 @@ class ModelTests(unittest.TestCase):
             cdrom_info = inst.vmstorage_lookup(vm_name, cdrom_dev)
             cur_cdrom_path = re.sub(":80/", '/', cdrom_info['path'])
 
-            # Check QEMU stream DNS to determine the cdrom path
-            qemu_stream_dns = FeatureTests.qemu_iso_stream_dns()
-            if not qemu_stream_dns:
-                output = urlparse.urlparse(valid_remote_iso_path)
-                hostname = socket.gethostbyname(output.hostname)
-                url = valid_remote_iso_path.replace(output.hostname, hostname)
-                self.assertEquals(url, cur_cdrom_path)
-            else:
-                self.assertEquals(valid_remote_iso_path, cur_cdrom_path)
+            # As Kimchi server is not running during this test case
+            # CapabilitiesModel.qemu_stream_dns will be always False
+            # so we need to convert the hostname to IP
+            output = urlparse.urlparse(valid_remote_iso_path)
+            hostname = socket.gethostbyname(output.hostname)
+            url = valid_remote_iso_path.replace(output.hostname, hostname)
+            self.assertEquals(url, cur_cdrom_path)
 
     @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
     def test_vm_storage_provisioning(self):
-- 
1.9.3




More information about the Kimchi-devel mailing list