neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
0b05ab
From c495f74951caa0104636032e00704a83ab5f73b1 Mon Sep 17 00:00:00 2001
0b05ab
From: Vojtech Trefny <vtrefny@redhat.com>
0b05ab
Date: Tue, 26 Mar 2019 12:58:53 +0100
0b05ab
Subject: [PATCH 1/3] Properly clean after availability test case
0b05ab
0b05ab
We need to set availability of the 'mkfs.hfsplus' utility back to
0b05ab
it's real value after changing it to "always available" for this
0b05ab
test case.
0b05ab
---
0b05ab
 tests/devices_test/dependencies_test.py | 3 +++
0b05ab
 1 file changed, 3 insertions(+)
0b05ab
0b05ab
diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
0b05ab
index 9dbdd24d..76bf758b 100644
0b05ab
--- a/tests/devices_test/dependencies_test.py
0b05ab
+++ b/tests/devices_test/dependencies_test.py
0b05ab
@@ -69,6 +69,7 @@ class MockingDeviceDependenciesTestCase1(unittest.TestCase):
0b05ab
 
0b05ab
         self.mdraid_method = availability.BLOCKDEV_MDRAID_PLUGIN._method
0b05ab
         self.dm_method = availability.BLOCKDEV_DM_PLUGIN._method
0b05ab
+        self.hfsplus_method = availability.MKFS_HFSPLUS_APP._method
0b05ab
         self.cache_availability = availability.CACHE_AVAILABILITY
0b05ab
 
0b05ab
         self.addCleanup(self._clean_up)
0b05ab
@@ -105,10 +106,12 @@ class MockingDeviceDependenciesTestCase1(unittest.TestCase):
0b05ab
     def _clean_up(self):
0b05ab
         availability.BLOCKDEV_MDRAID_PLUGIN._method = self.mdraid_method
0b05ab
         availability.BLOCKDEV_DM_PLUGIN._method = self.dm_method
0b05ab
+        availability.MKFS_HFSPLUS_APP._method = self.hfsplus_method
0b05ab
 
0b05ab
         availability.CACHE_AVAILABILITY = False
0b05ab
         availability.BLOCKDEV_MDRAID_PLUGIN.available  # pylint: disable=pointless-statement
0b05ab
         availability.BLOCKDEV_DM_PLUGIN.available  # pylint: disable=pointless-statement
0b05ab
+        availability.MKFS_HFSPLUS_APP.available  # pylint: disable=pointless-statement
0b05ab
 
0b05ab
         availability.CACHE_AVAILABILITY = self.cache_availability
0b05ab
 
0b05ab
-- 
0b05ab
2.20.1
0b05ab
0b05ab
0b05ab
From a6798882f5ba5b1e0ea655255d6f1fd5eda85f64 Mon Sep 17 00:00:00 2001
0b05ab
From: Vojtech Trefny <vtrefny@redhat.com>
0b05ab
Date: Tue, 26 Mar 2019 13:00:40 +0100
0b05ab
Subject: [PATCH 2/3] Skip weak dependencies test if we don't have all
0b05ab
 libblockdev plugins
0b05ab
0b05ab
This test checks that creating devices works when we have all
0b05ab
plugins and fails "nicely" if we don't have all plugins so we
0b05ab
actually need all the plugins for this test case.
0b05ab
---
0b05ab
 tests/devices_test/dependencies_test.py | 5 +++++
0b05ab
 1 file changed, 5 insertions(+)
0b05ab
0b05ab
diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
0b05ab
index 76bf758b..308d6192 100644
0b05ab
--- a/tests/devices_test/dependencies_test.py
0b05ab
+++ b/tests/devices_test/dependencies_test.py
0b05ab
@@ -157,6 +157,11 @@ class MissingWeakDependenciesTestCase(unittest.TestCase):
0b05ab
         self.disk1_file = create_sparse_tempfile("disk1", Size("2GiB"))
0b05ab
         self.plugins = blockdev.plugin_specs_from_names(blockdev.get_available_plugin_names())
0b05ab
 
0b05ab
+        loaded_plugins = self.load_all_plugins()
0b05ab
+        if not all(p in loaded_plugins for p in ("btrfs", "crypto", "lvm", "md")):
0b05ab
+            # we don't have all plugins needed for this test case
0b05ab
+            self.skipTest("Missing libblockdev plugins needed from weak dependencies test.")
0b05ab
+
0b05ab
     def _clean_up(self):
0b05ab
         # reload all libblockdev plugins
0b05ab
         self.load_all_plugins()
0b05ab
-- 
0b05ab
2.20.1
0b05ab
0b05ab
0b05ab
From 151fce2c9a98dc5a7943b314828518518a755ec8 Mon Sep 17 00:00:00 2001
0b05ab
From: Vojtech Trefny <vtrefny@redhat.com>
0b05ab
Date: Tue, 26 Mar 2019 13:36:31 +0100
0b05ab
Subject: [PATCH 3/3] Check for format tools availability in action_test
0b05ab
0b05ab
---
0b05ab
 tests/action_test.py | 16 ++++++++++++++++
0b05ab
 1 file changed, 16 insertions(+)
0b05ab
0b05ab
diff --git a/tests/action_test.py b/tests/action_test.py
0b05ab
index 93ed9e57..101d5a21 100644
0b05ab
--- a/tests/action_test.py
0b05ab
+++ b/tests/action_test.py
0b05ab
@@ -19,6 +19,13 @@ from blivet.devices import MDRaidArrayDevice
0b05ab
 from blivet.devices import LVMVolumeGroupDevice
0b05ab
 from blivet.devices import LVMLogicalVolumeDevice
0b05ab
 
0b05ab
+# format classes
0b05ab
+from blivet.formats.fs import Ext2FS
0b05ab
+from blivet.formats.fs import Ext3FS
0b05ab
+from blivet.formats.fs import Ext4FS
0b05ab
+from blivet.formats.fs import FATFS
0b05ab
+from blivet.formats.fs import XFS
0b05ab
+
0b05ab
 # action classes
0b05ab
 from blivet.deviceaction import ActionCreateDevice
0b05ab
 from blivet.deviceaction import ActionResizeDevice
0b05ab
@@ -39,8 +46,17 @@ DEVICE_CLASSES = [
0b05ab
     LVMLogicalVolumeDevice
0b05ab
 ]
0b05ab
 
0b05ab
+FORMAT_CLASSES = [
0b05ab
+    Ext2FS,
0b05ab
+    Ext3FS,
0b05ab
+    Ext4FS,
0b05ab
+    FATFS,
0b05ab
+    XFS
0b05ab
+]
0b05ab
+
0b05ab
 
0b05ab
 @unittest.skipUnless(not any(x.unavailable_type_dependencies() for x in DEVICE_CLASSES), "some unsupported device classes required for this test")
0b05ab
+@unittest.skipUnless(not any(x().utils_available for x in FORMAT_CLASSES), "some unsupported format classes required for this test")
0b05ab
 class DeviceActionTestCase(StorageTestCase):
0b05ab
 
0b05ab
     """ DeviceActionTestSuite """
0b05ab
-- 
0b05ab
2.20.1
0b05ab