Mark Wu has uploaded a new change for review.

Change subject: tests: Fix parted_utils_tests break on fedora 18
......................................................................

tests: Fix parted_utils_tests break on fedora 18

parted 3.1 improves its support for loopback devices. The 'model' string
returned by libparted is updated to 'Loopback device'. For more information,
please see the parted commit 3e35b655.

Change-Id: I1accc7eb6fc6c64b5e27fb27d9e675ad523725b0
Signed-off-by: Mark Wu <[email protected]>
---
M tests/parted_utils_tests.py
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/43/10843/1

diff --git a/tests/parted_utils_tests.py b/tests/parted_utils_tests.py
index 808d748..bb6bc8c 100644
--- a/tests/parted_utils_tests.py
+++ b/tests/parted_utils_tests.py
@@ -20,6 +20,7 @@
 
 import tempfile
 import os
+import rpm
 import time
 
 import testValidation
@@ -39,6 +40,15 @@
 PART_SIZE_MB = 50
 FREE_SIZE = 50 * ONE_MB_IN_BYTES
 PART_END_SIZE = 47 * ONE_MB_IN_BYTES
+
+# parted 3.1 improves its support for loopback devices. The 'model' string
+# returned by libparted is updated to 'Loopback device'
+ts = rpm.TransactionSet()
+parted_version = float(list(ts.dbMatch('name', 'parted'))[0]['version'])
+if parted_version >= 3.1:
+    LOOP_DEVICE_MODEL = 'Loopback device'
+else:
+    LOOP_DEVICE_MODEL = ''
 
 
 class PartedUtilsTests(TestCaseBase):
@@ -79,7 +89,7 @@
 
     def _blank_dev_test(self):
         info = putils.getDevicePartedInfo(self.devPath)
-        self.assertFalse(info['model'])
+        self.assertEquals(info['model'], LOOP_DEVICE_MODEL)
         self.assertTrue(info['sectorSize'] >= 0)
         self.assertFalse(info['type'])
         self.assertFalse(info['partitions'])
@@ -99,7 +109,7 @@
         time.sleep(1)  # wait for syncing
 
         info = putils.getDevicePartedInfo(self.devPath)
-        self.assertFalse(info['model'])
+        self.assertEquals(info['model'], LOOP_DEVICE_MODEL)
         self.assertTrue(info['sectorSize'] >= 0)
         self.assertEquals(info['type'], 'gpt')
         self.assertTrue(info['freeSpaceRegions'][0][3] >= FREE_SIZE)


--
To view, visit http://gerrit.ovirt.org/10843
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1accc7eb6fc6c64b5e27fb27d9e675ad523725b0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to